public class DbFactory { /// <summary> /// SqlSugarClient属性 /// </summary> /// <returns></returns> public static SqlSugarClient GetSqlSugarClient() { var db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, //必填(连接字符串) DbType = DbType.MySql, //必填(那个数据库) IsAutoCloseConnection = false, //默认false(是否自动关闭连接) InitKeyType = InitKeyType.Attribute }); //默认SystemTable return db; } } //配置SQLsugar(连接字符串啥的)
Unity
[Dependency]
自动依赖注入