using Newtonsoft.Json; using System.Collections.Generic; namespace SqlSugar { public class ConnectionConfig { /// ///DbType.SqlServer Or Other /// public DbType DbType { get; set; } /// ///Database Connection string /// public string ConnectionString { get; set; } /// /// true does not need to close the connection /// public bool IsAutoCloseConnection { get; set; } /// /// Default SystemTable,If you do not have system table permissions, use attribute /// public InitKeyType InitKeyType = InitKeyType.SystemTable; /// ///If true, there is only one connection instance in the same thread within the same connection string /// public bool IsShardSameThread { get; set; } /// /// Configure External Services replace default services,For example, Redis storage /// [JsonIgnore] public ConfigureExternalServices ConfigureExternalServices = _DefaultServices; private static ConfigureExternalServices _DefaultServices = new ConfigureExternalServices(); /// /// If SlaveConnectionStrings has value,ConnectionString is write operation, SlaveConnectionStrings is read operation. /// All operations within a transaction is ConnectionString /// public List SlaveConnectionConfigs { get; set; } /// /// More Gobal Settings /// public ConnMoreSettings MoreSettings { get; set; } } public class ConfigureExternalServices { private ISerializeService _SerializeService; private ICacheService _ReflectionInoCache; private ICacheService _DataInfoCache; public ISerializeService SerializeService { get { if (_SerializeService == null) return DefaultServices.Serialize; else return _SerializeService; } set{ _SerializeService = value;} } public ICacheService ReflectionInoCacheService { get { if (_ReflectionInoCache == null) return DefaultServices.ReflectionInoCache; else return _ReflectionInoCache; } set{_ReflectionInoCache = value;} } public ICacheService DataInfoCacheService { get { if (_DataInfoCache == null) return DefaultServices.DataInoCache; else return _DataInfoCache; } set { _DataInfoCache = value; } } public List SqlFuncServices { get; set; } public List> AppendDataReaderTypeMappings { get; set; } } }