欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

SqlSugarClientHelper

程序员文章站 2022-05-13 22:37:13
using SqlSugar; using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Web; namespace Web.Code.DA... ......
using sqlsugar;
using system;
using system.collections.generic;
using system.configuration;
using system.linq;
using system.web;

namespace web.code.dal
{
    public static class sqlsugarclienthelper
    {
        public static string connectionstring = configurationmanager.connectionstrings["connectionstring"].connectionstring;

        public static sqlsugarclient sqldbconnection
        {
            get => new sqlsugarclient(new connectionconfig()

            {
                connectionstring = connectionstring,//必填, 数据库连接字符串
                dbtype = sqlsugar.dbtype.sqlserver,         //必填, 数据库类型
                isautocloseconnection = true,       //默认false, 不自动关闭数据库连接。设置为true无需使用using或者close操作,自动释放。
                initkeytype = initkeytype.systemtable    //默认systemtable, 字段信息读取, 如:该属性是不是主键,是不是标识列等等信息

            });
        }
    }
}