diff --git a/Src/Asp.Net/SqlSugar/Entities/ConnectionConfig.cs b/Src/Asp.Net/SqlSugar/Entities/ConnectionConfig.cs index 006a693c3..a14655aee 100644 --- a/Src/Asp.Net/SqlSugar/Entities/ConnectionConfig.cs +++ b/Src/Asp.Net/SqlSugar/Entities/ConnectionConfig.cs @@ -23,5 +23,14 @@ namespace SqlSugar /// Default SystemTable,If you do not have system table permissions, use attribute /// public InitKeyType InitKeyType = InitKeyType.SystemTable; + /// + /// + /// + public ConfigureServices ConfigureExternalServices { get; set; } + } + + public class ConfigureServices + { + public ISerializeManager SerializeManager { get; set; } } } diff --git a/Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs b/Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs index 7440b37af..205619dbd 100644 --- a/Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs +++ b/Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; namespace SqlSugar { - public class ContextMethods : IRewritableMethods + public class ContextMethods : IContextMethods { #region DataReader @@ -263,7 +263,7 @@ namespace SqlSugar #endregion #region Cache - public ICacheManager GetCacheInstance() + public ICacheService GetCacheInstance() { return ReflectionInoCache.GetInstance(); } diff --git a/Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs b/Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs index 60a28628f..3552e8d49 100644 --- a/Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs +++ b/Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs @@ -356,13 +356,13 @@ namespace SqlSugar #endregion #region Services - public static ICacheManager GetCacheInstance() + public static ICacheService GetCacheInstance() { return ReflectionInoCache.GetInstance(); } public static ISerializeManager GetSerializeInstance() { - return SerializeManager.GetInstance(); + return SerializeService.GetInstance(); } #endregion } diff --git a/Src/Asp.Net/SqlSugar/Infrastructure/SqlSugarAccessory.cs b/Src/Asp.Net/SqlSugar/Infrastructure/SqlSugarAccessory.cs index 2f01296b3..20af717cb 100644 --- a/Src/Asp.Net/SqlSugar/Infrastructure/SqlSugarAccessory.cs +++ b/Src/Asp.Net/SqlSugar/Infrastructure/SqlSugarAccessory.cs @@ -25,7 +25,7 @@ namespace SqlSugar protected EntityMaintenance _EntityProvider; protected IAdo _Ado; protected ILambdaExpressions _LambdaExpressions; - protected IRewritableMethods _RewritableMethods; + protected IContextMethods _RewritableMethods; protected IDbMaintenance _DbMaintenance; protected QueryFilterProvider _QueryFilterProvider; protected SimpleClient _SimpleClient; diff --git a/Src/Asp.Net/SqlSugar/Interface/ICacheManager.cs b/Src/Asp.Net/SqlSugar/Interface/ICacheService.cs similarity index 69% rename from Src/Asp.Net/SqlSugar/Interface/ICacheManager.cs rename to Src/Asp.Net/SqlSugar/Interface/ICacheService.cs index 6bfb10531..9862d28c0 100644 --- a/Src/Asp.Net/SqlSugar/Interface/ICacheManager.cs +++ b/Src/Asp.Net/SqlSugar/Interface/ICacheService.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace SqlSugar { - public interface ICacheManager + public interface ICacheService { V this[string key] { get; } void Add(string key, V value); @@ -12,6 +12,6 @@ namespace SqlSugar V Get(string key); IEnumerable GetAllKey(); void Remove(string key); - V GetOrCreate(string cacheKey, Func, string, V> successAction, Func, string, V> errorAction); + V GetOrCreate(string cacheKey, Func, string, V> successAction, Func, string, V> errorAction); } } \ No newline at end of file diff --git a/Src/Asp.Net/SqlSugar/Interface/IRewritableMethods.cs b/Src/Asp.Net/SqlSugar/Interface/IContextMethods.cs similarity index 89% rename from Src/Asp.Net/SqlSugar/Interface/IRewritableMethods.cs rename to Src/Asp.Net/SqlSugar/Interface/IContextMethods.cs index fbc68a3b3..e0cec73ea 100644 --- a/Src/Asp.Net/SqlSugar/Interface/IRewritableMethods.cs +++ b/Src/Asp.Net/SqlSugar/Interface/IContextMethods.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace SqlSugar { - public interface IRewritableMethods + public interface IContextMethods { ExpandoObject DataReaderToExpandoObject(IDataReader reader); List DataReaderToExpandoObjectList(IDataReader reader); @@ -18,7 +18,7 @@ namespace SqlSugar T TranslateCopy(T sourceObject); SqlSugarClient CopyContext(SqlSugarClient context, bool isCopyEvents = false); dynamic DataTableToDynamic(DataTable table); - ICacheManager GetCacheInstance(); + ICacheService GetCacheInstance(); void RemoveCacheAll(); void RemoveCacheAll(); void RemoveCache(string key); diff --git a/Src/Asp.Net/SqlSugar/Interface/ISerializeManager.cs b/Src/Asp.Net/SqlSugar/Interface/ISerializeService.cs similarity index 84% rename from Src/Asp.Net/SqlSugar/Interface/ISerializeManager.cs rename to Src/Asp.Net/SqlSugar/Interface/ISerializeService.cs index eed4df661..3441076b4 100644 --- a/Src/Asp.Net/SqlSugar/Interface/ISerializeManager.cs +++ b/Src/Asp.Net/SqlSugar/Interface/ISerializeService.cs @@ -5,7 +5,7 @@ using System.Text; namespace SqlSugar { - public interface ISerializeManager + public interface ISerializeService { string SerializeObject(object value); T DeserializeObject(string value); diff --git a/Src/Asp.Net/SqlSugar/Utilities/CacheManager.cs b/Src/Asp.Net/SqlSugar/Services/CacheService.cs similarity index 94% rename from Src/Asp.Net/SqlSugar/Utilities/CacheManager.cs rename to Src/Asp.Net/SqlSugar/Services/CacheService.cs index 1d94d31b8..39eb00cc0 100644 --- a/Src/Asp.Net/SqlSugar/Utilities/CacheManager.cs +++ b/Src/Asp.Net/SqlSugar/Services/CacheService.cs @@ -6,7 +6,7 @@ using System.Collections; using System.Linq.Expressions; namespace SqlSugar { - public class ReflectionInoCache : ICacheManager + public class ReflectionInoCache : ICacheService { readonly System.Collections.Concurrent.ConcurrentDictionary InstanceCache = new System.Collections.Concurrent.ConcurrentDictionary(); private static ReflectionInoCache _instance = null; @@ -76,7 +76,7 @@ namespace SqlSugar return this.InstanceCache.Keys; } - public V GetOrCreate(string cacheKey, Func, string, V> successAction, Func, string, V> errorAction) + public V GetOrCreate(string cacheKey, Func, string, V> successAction, Func, string, V> errorAction) { var cm = ReflectionInoCache.GetInstance(); if (cm.ContainsKey(cacheKey)) return successAction(cm, cacheKey); diff --git a/Src/Asp.Net/SqlSugar/Utilities/SerializeManager.cs b/Src/Asp.Net/SqlSugar/Services/SerializeService.cs similarity index 77% rename from Src/Asp.Net/SqlSugar/Utilities/SerializeManager.cs rename to Src/Asp.Net/SqlSugar/Services/SerializeService.cs index de15301d3..59c5c60e1 100644 --- a/Src/Asp.Net/SqlSugar/Utilities/SerializeManager.cs +++ b/Src/Asp.Net/SqlSugar/Services/SerializeService.cs @@ -6,16 +6,16 @@ using System.Text; namespace SqlSugar { - public class SerializeManager:ISerializeManager + public class SerializeService:ISerializeService { - private static SerializeManager _instance = null; + private static SerializeService _instance = null; private static readonly object _instanceLock = new object(); - public static SerializeManager GetInstance() { + public static SerializeService GetInstance() { if (_instance == null) lock (_instanceLock) if (_instance == null) { - _instance = new SerializeManager(); + _instance = new SerializeService(); } return _instance; } diff --git a/Src/Asp.Net/SqlSugar/SqlSugar.csproj b/Src/Asp.Net/SqlSugar/SqlSugar.csproj index 0d7261549..dc524af6b 100644 --- a/Src/Asp.Net/SqlSugar/SqlSugar.csproj +++ b/Src/Asp.Net/SqlSugar/SqlSugar.csproj @@ -93,11 +93,11 @@ - + - + @@ -134,7 +134,7 @@ - + @@ -160,7 +160,7 @@ - + @@ -239,7 +239,7 @@ - + diff --git a/Src/Asp.Net/SqlSugar/SqlSugarClient.cs b/Src/Asp.Net/SqlSugar/SqlSugarClient.cs index 7e56156b4..abb6f7441 100644 --- a/Src/Asp.Net/SqlSugar/SqlSugarClient.cs +++ b/Src/Asp.Net/SqlSugar/SqlSugarClient.cs @@ -68,12 +68,12 @@ namespace SqlSugar #region Util Methods [Obsolete("Use SqlSugarClient.Utilities")] - public virtual IRewritableMethods RewritableMethods + public virtual IContextMethods RewritableMethods { get { return this.Utilities; } set { this.Utilities = value; } } - public virtual IRewritableMethods Utilities + public virtual IContextMethods Utilities { get {