This commit is contained in:
sunkaixuan
2017-09-28 16:40:08 +08:00
parent 7172e67d5f
commit 0957e79a44
4 changed files with 65 additions and 18 deletions

View File

@@ -29,11 +29,55 @@ namespace SqlSugar
public ConfigureExternalServices ConfigureExternalServices = _DefaultServices;
private static ConfigureExternalServices _DefaultServices = new ConfigureExternalServices();
}
public class ConfigureExternalServices
{
public ISerializeService SerializeService =DefaultServices.Serialize;
public ICacheService ReflectionInoCache = DefaultServices.ReflectionInoCache;
public ICacheService DataInfoCache { get; set; }
public ISerializeService SerializeService
{
get
{
if (DefaultServices.Serialize == null)
DefaultServices.Serialize = new SerializeService();
return DefaultServices.Serialize;
}
set
{
lock (DefaultServices.Serialize)
{
DefaultServices.Serialize = value;
}
}
}
public ICacheService ReflectionInoCache
{
get
{
if (DefaultServices.ReflectionInoCache == null)
DefaultServices.ReflectionInoCache = new ReflectionInoCache();
return DefaultServices.ReflectionInoCache;
}
set
{
lock (DefaultServices.ReflectionInoCache)
{
DefaultServices.ReflectionInoCache = value;
}
}
}
public ICacheService DataInfoCache
{
get
{
Check.ArgumentNullException(DefaultServices.DataInoCache, "The data cache needs to be set ConnectionConfig.ConfigureExternalServices.DataInfoCache");
return DefaultServices.DataInoCache;
}
set
{
lock (DefaultServices.DataInoCache)
{
DefaultServices.DataInoCache = value;
}
}
}
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SqlSugar
{
public class DefaultServices
{
public static ICacheService ReflectionInoCache { get; set; }
public static ICacheService DataInoCache
{
get; set;
public static ISerializeService Serialize { get; set; }
}
}

View File

@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SqlSugar
{
public class DefaultServices
{
public static ICacheService ReflectionInoCache = new ReflectionInoCache();
public static ISerializeService Serialize = new SerializeService();
}
}

View File

@@ -94,7 +94,7 @@
<Compile Include="ExpressionsToSql\Subquery\SubTools.cs" />
<Compile Include="Infrastructure\DependencyManagement.cs" />
<Compile Include="IntegrationInterface\ISerializeService.cs" />
<Compile Include="IntegrationServices\DefaultServices.cs" />
<Compile Include="Entities\DefaultServices.cs" />
<Compile Include="Realization\Oracle\Deleteable\OracleDeleteable.cs" />
<Compile Include="Realization\Oracle\Insertable\OracleInsertable.cs" />
<Compile Include="Realization\Oracle\Updateable\OracleUpdateable.cs" />