修改配置
说明:创建对象时,连接参数: MoreSettings
1.使用案例
目前已知的属性和字段
public class ConnMoreSettings
{
public bool PgSqlIsAutoToLower;
public ConnMoreSettings();
public bool IsAutoRemoveDataCache { get; set; }
public bool IsWithNoLockQuery { get; set; }
public bool DisableNvarchar { get; set; }
public bool DisableMillisecond { get; set; }
public int DefaultCacheDurationInSeconds { get; set; }
public bool? TableEnumIsString { get; set; }
public DateTime? DbMinDate { get; set; }
}
1.1 案例一
public static SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{
DbType = SqlSugar.DbType.MySql,
ConnectionString = "server = 127.0.0.1; Database = sugarlearn; Uid = root; Pwd = root; AllowLoadLocalInfile = true;",
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
//看这里
MoreSettings=new ConnMoreSettings()
{
DisableNvarchar = true,
DbMinDate = DateTime.MinValue
}
});
}
1.2 案例二
public static SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{
DbType = SqlSugar.DbType.MySql,
ConnectionString = "server = 127.0.0.1; Database = sugarlearn; Uid = root; Pwd = root; AllowLoadLocalInfile = true;",
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true
});
//看这里
db.CurrentConnectionConfig.MoreSettings = new ConnMoreSettings()
{
DisableNvarchar = true,
DbMinDate = DateTime.MinValue
};
}
2.使用过程中不允许修改的参数
- DbType 数据库类型
- ConnectionString 连接字符串
- ConfigId 多租户唯一标识
其他参数都可以在使用的过程中随意更改