Update SqlSugarClient

This commit is contained in:
sunkaixuan
2019-05-04 17:32:39 +08:00
parent 04a457bdfc
commit 4dc9a7abfe
15 changed files with 128 additions and 111 deletions

View File

@@ -9,7 +9,7 @@ namespace SqlSugar
{
public abstract partial class DbFirstProvider : IDbFirst
{
public virtual SqlSugarContext Context { get; set; }
public virtual ISqlSugarClient Context { get; set; }
private string ClassTemplate { get; set; }
private string ClassDescriptionTemplate { get; set; }
private string PropertyTemplate { get; set; }

View File

@@ -12,7 +12,7 @@ namespace SqlSugar
{
public class DeleteableProvider<T> : IDeleteable<T> where T : class, new()
{
public SqlSugarContext Context { get; set; }
public ISqlSugarClient Context { get; set; }
public IAdo Db { get { return Context.Ado; } }
public ISqlBuilder SqlBuilder { get; set; }
public DeleteBuilder DeleteBuilder { get; set; }

View File

@@ -10,7 +10,7 @@ namespace SqlSugar
{
public class InsertableProvider<T> : IInsertable<T> where T : class, new()
{
public SqlSugarContext Context { get; set; }
public ISqlSugarClient Context { get; set; }
public IAdo Ado { get { return Context.Ado; } }
public ISqlBuilder SqlBuilder { get; set; }
public InsertBuilder InsertBuilder { get; set; }

View File

@@ -16,7 +16,7 @@ namespace SqlSugar
#region T1
public partial class QueryableProvider<T> : QueryableAccessory, ISugarQueryable<T>
{
public SqlSugarContext Context { get; set; }
public ISqlSugarClient Context { get; set; }
public IAdo Db { get { return Context.Ado; } }
public IDbBind Bind { get { return this.Db.DbBind; } }
public ISqlBuilder SqlBuilder { get; set; }
@@ -1116,7 +1116,7 @@ namespace SqlSugar
protected ISugarQueryable<TResult> _Select<TResult>(Expression expression)
{
QueryBuilder.CheckExpression(expression, "Select");
this.Context.InitMppingInfo<TResult>();
this.Context.InitMppingInfo(typeof(TResult));
var result = InstanceFactory.GetQueryable<TResult>(this.Context.CurrentConnectionConfig);
result.Context = this.Context;
result.SqlBuilder = this.SqlBuilder;

View File

@@ -7,7 +7,7 @@ namespace SqlSugar
{
internal class CacheKeyBuider
{
public static CacheKey GetKey(SqlSugarContext context, QueryBuilder queryBuilder)
public static CacheKey GetKey(ISqlSugarClient context, QueryBuilder queryBuilder)
{
CacheKey result = new CacheKey();
result.Database = context.Context.Ado.Connection.Database;
@@ -38,7 +38,7 @@ namespace SqlSugar
}
}
private static void AddTables(SqlSugarContext context, QueryBuilder queryBuilder, CacheKey result)
private static void AddTables(ISqlSugarClient context, QueryBuilder queryBuilder, CacheKey result)
{
result.Tables = new List<string>();
result.Tables.Add(context.EntityMaintenance.GetTableName(queryBuilder.EntityName));

View File

@@ -7,7 +7,7 @@ namespace SqlSugar
{
internal class CacheSchemeMain
{
public static T GetOrCreate<T>(ICacheService cacheService, QueryBuilder queryBuilder, Func<T> getData, int cacheDurationInSeconds, SqlSugarContext context)
public static T GetOrCreate<T>(ICacheService cacheService, QueryBuilder queryBuilder, Func<T> getData, int cacheDurationInSeconds, ISqlSugarClient context)
{
CacheKey key = CacheKeyBuider.GetKey(context, queryBuilder);
string keyString = key.ToString();

View File

@@ -9,11 +9,11 @@ namespace SqlSugar
{
private Dictionary<string, object> caches = new Dictionary<string, object>();
private List<T> _list { get; set; }
private SqlSugarContext _context { get; set; }
private ISqlSugarClient _context { get; set; }
private MapperCache()
{
}
public MapperCache(List<T> list, SqlSugarContext context)
public MapperCache(List<T> list, ISqlSugarClient context)
{
_list = list;
_context = context;

View File

@@ -11,7 +11,7 @@ namespace SqlSugar
/// Equal to NULL representing global
/// </summary>
public string FilterName { get; set; }
public Func<SqlSugarContext,SqlFilterResult> FilterValue { get; set; }
public Func<ISqlSugarClient,SqlFilterResult> FilterValue { get; set; }
/// <summary>
/// Is it a multiple table query?
/// </summary>

View File

@@ -8,8 +8,8 @@ namespace SqlSugar
{
public class SugarMapper
{
private SqlSugarContext _context;
public SugarMapper(SqlSugarContext context)
private ISqlSugarClient _context;
public SugarMapper(ISqlSugarClient context)
{
_context = context;
}

View File

@@ -10,32 +10,12 @@ namespace SqlSugar
public partial class SqlSugarContext
{
#region Properties
public SqlSugarContext Context
public ISqlSugarClient Context
{
get
{
var result = _Context; ;
if (CurrentConnectionConfig.IsShardSameThread)
{
if (CallContext.ContextList.Value.IsNullOrEmpty())
{
CallContext.ContextList.Value = new List<SqlSugarContext>();
CallContext.ContextList.Value.Add(_Context);
}
else
{
var cacheContext = CallContext.ContextList.Value.FirstOrDefault(it =>
it.CurrentConnectionConfig.ConnectionString == _Context.CurrentConnectionConfig.ConnectionString &&
it.CurrentConnectionConfig.DbType == _Context.CurrentConnectionConfig.DbType &&
it.CurrentConnectionConfig.IsAutoCloseConnection == _Context.CurrentConnectionConfig.IsAutoCloseConnection &&
it.CurrentConnectionConfig.IsShardSameThread == _Context.CurrentConnectionConfig.IsShardSameThread);
if (cacheContext != null)
{
return cacheContext;
}
}
}
return result;
_Context = this;
return _Context;
}
set
{
@@ -47,15 +27,15 @@ namespace SqlSugar
public bool IsSystemTablesConfig { get { return this.CurrentConnectionConfig.InitKeyType == InitKeyType.SystemTable; } }
public Guid ContextID { get; set; }
internal bool IsAsyncMethod { get; set; }
public MappingTableList MappingTables = new MappingTableList();
public MappingColumnList MappingColumns = new MappingColumnList();
public IgnoreColumnList IgnoreColumns = new IgnoreColumnList();
public IgnoreColumnList IgnoreInsertColumns = new IgnoreColumnList();
public MappingTableList MappingTables { get; set; }
public MappingColumnList MappingColumns { get; set; }
public IgnoreColumnList IgnoreColumns { get; set; }
public IgnoreColumnList IgnoreInsertColumns { get; set; }
#endregion
#region Fields
protected ISqlBuilder _SqlBuilder;
protected SqlSugarContext _Context { get; set; }
protected ISqlSugarClient _Context { get; set; }
protected EntityMaintenance _EntityProvider;
protected IAdo _Ado;
protected ILambdaExpressions _LambdaExpressions;
@@ -67,22 +47,22 @@ namespace SqlSugar
{
get
{
return this.Context._Ado;
return this._Ado;
}
set
{
this.Context._Ado = value;
this._Ado = value;
}
}
protected IContextMethods ContextRewritableMethods
{
get
{
return this.Context._RewritableMethods;
return this._RewritableMethods;
}
set
{
this.Context._RewritableMethods = value;
this._RewritableMethods = value;
}
}
#endregion
@@ -206,42 +186,42 @@ namespace SqlSugar
private void InitMppingInfo(EntityInfo entityInfo)
{
if (this.Context.MappingTables == null)
this.Context.MappingTables = new MappingTableList();
if (this.Context.MappingColumns == null)
this.Context.MappingColumns = new MappingColumnList();
if (this.Context.IgnoreColumns == null)
this.Context.IgnoreColumns = new IgnoreColumnList();
if (this.Context.IgnoreInsertColumns == null)
this.Context.IgnoreInsertColumns = new IgnoreColumnList();
if (!this.Context.MappingTables.Any(it => it.EntityName == entityInfo.EntityName))
if (this.MappingTables == null)
this.MappingTables = new MappingTableList();
if (this.MappingColumns == null)
this.MappingColumns = new MappingColumnList();
if (this.IgnoreColumns == null)
this.IgnoreColumns = new IgnoreColumnList();
if (this.IgnoreInsertColumns == null)
this.IgnoreInsertColumns = new IgnoreColumnList();
if (!this.MappingTables.Any(it => it.EntityName == entityInfo.EntityName))
{
if (entityInfo.DbTableName != entityInfo.EntityName && entityInfo.DbTableName.HasValue())
{
this.Context.MappingTables.Add(entityInfo.EntityName, entityInfo.DbTableName);
this.MappingTables.Add(entityInfo.EntityName, entityInfo.DbTableName);
}
}
if (entityInfo.Columns.Any(it => it.EntityName == entityInfo.EntityName))
{
var mappingColumnInfos = this.Context.MappingColumns.Where(it => it.EntityName == entityInfo.EntityName);
var mappingColumnInfos = this.MappingColumns.Where(it => it.EntityName == entityInfo.EntityName);
foreach (var item in entityInfo.Columns.Where(it => it.IsIgnore == false))
{
if (!mappingColumnInfos.Any(it => it.PropertyName == item.PropertyName))
if (item.PropertyName != item.DbColumnName && item.DbColumnName.HasValue())
this.Context.MappingColumns.Add(item.PropertyName, item.DbColumnName, item.EntityName);
this.MappingColumns.Add(item.PropertyName, item.DbColumnName, item.EntityName);
}
var ignoreInfos = this.Context.IgnoreColumns.Where(it => it.EntityName == entityInfo.EntityName);
var ignoreInfos = this.IgnoreColumns.Where(it => it.EntityName == entityInfo.EntityName);
foreach (var item in entityInfo.Columns.Where(it => it.IsIgnore))
{
if (!ignoreInfos.Any(it => it.PropertyName == item.PropertyName))
this.Context.IgnoreColumns.Add(item.PropertyName, item.EntityName);
this.IgnoreColumns.Add(item.PropertyName, item.EntityName);
}
var ignoreInsertInfos = this.Context.IgnoreInsertColumns.Where(it => it.EntityName == entityInfo.EntityName);
var ignoreInsertInfos = this.IgnoreInsertColumns.Where(it => it.EntityName == entityInfo.EntityName);
foreach (var item in entityInfo.Columns.Where(it => it.IsOnlyIgnoreInsert))
{
if (!ignoreInsertInfos.Any(it => it.PropertyName == item.PropertyName))
this.Context.IgnoreInsertColumns.Add(item.PropertyName, item.EntityName);
this.IgnoreInsertColumns.Add(item.PropertyName, item.EntityName);
}
}
}
@@ -261,7 +241,7 @@ namespace SqlSugar
result.SqlBuilder = sqlBuilder;
result.SqlBuilder.QueryBuilder = InstanceFactory.GetQueryBuilder(CurrentConnectionConfig);
result.SqlBuilder.QueryBuilder.Builder = sqlBuilder;
result.SqlBuilder.Context = result.SqlBuilder.QueryBuilder.Context = this.Context;
result.SqlBuilder.Context = result.SqlBuilder.QueryBuilder.Context = this;
result.SqlBuilder.QueryBuilder.EntityType = typeof(T);
result.SqlBuilder.QueryBuilder.EntityName = typeof(T).Name;
result.SqlBuilder.QueryBuilder.LambdaExpressions = InstanceFactory.GetLambdaExpressions(CurrentConnectionConfig);
@@ -271,14 +251,14 @@ namespace SqlSugar
{
var result = InstanceFactory.GetInsertableProvider<T>(this.CurrentConnectionConfig);
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig); ;
result.Context = this.Context;
result.Context = this;
result.EntityInfo = this.Context.EntityMaintenance.GetEntityInfo<T>();
result.SqlBuilder = sqlBuilder;
result.InsertObjs = insertObjs;
sqlBuilder.InsertBuilder = result.InsertBuilder = InstanceFactory.GetInsertBuilder(this.CurrentConnectionConfig);
sqlBuilder.InsertBuilder.Builder = sqlBuilder;
sqlBuilder.InsertBuilder.LambdaExpressions = InstanceFactory.GetLambdaExpressions(this.CurrentConnectionConfig);
sqlBuilder.Context = result.SqlBuilder.InsertBuilder.Context = this.Context;
sqlBuilder.Context = result.SqlBuilder.InsertBuilder.Context = this;
result.Init();
return result;
}
@@ -286,26 +266,26 @@ namespace SqlSugar
{
var result = InstanceFactory.GetDeleteableProvider<T>(this.CurrentConnectionConfig);
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig); ;
result.Context = this.Context;
result.Context = this;
result.SqlBuilder = sqlBuilder;
sqlBuilder.DeleteBuilder = result.DeleteBuilder = InstanceFactory.GetDeleteBuilder(this.CurrentConnectionConfig);
sqlBuilder.DeleteBuilder.Builder = sqlBuilder;
sqlBuilder.DeleteBuilder.LambdaExpressions = InstanceFactory.GetLambdaExpressions(this.CurrentConnectionConfig);
sqlBuilder.Context = result.SqlBuilder.DeleteBuilder.Context = this.Context;
sqlBuilder.Context = result.SqlBuilder.DeleteBuilder.Context = this;
return result;
}
protected UpdateableProvider<T> CreateUpdateable<T>(T[] UpdateObjs) where T : class, new()
{
var result = InstanceFactory.GetUpdateableProvider<T>(this.CurrentConnectionConfig);
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig); ;
result.Context = this.Context;
result.Context = this;
result.EntityInfo = this.Context.EntityMaintenance.GetEntityInfo<T>();
result.SqlBuilder = sqlBuilder;
result.UpdateObjs = UpdateObjs;
sqlBuilder.UpdateBuilder = result.UpdateBuilder = InstanceFactory.GetUpdateBuilder(this.CurrentConnectionConfig);
sqlBuilder.UpdateBuilder.Builder = sqlBuilder;
sqlBuilder.UpdateBuilder.LambdaExpressions = InstanceFactory.GetLambdaExpressions(this.CurrentConnectionConfig);
sqlBuilder.Context = result.SqlBuilder.UpdateBuilder.Context = this.Context;
sqlBuilder.Context = result.SqlBuilder.UpdateBuilder.Context = this;
result.Init();
return result;
}
@@ -339,8 +319,8 @@ namespace SqlSugar
List<JoinQueryInfo> result = new List<JoinQueryInfo>();
var lambdaParameters = ((LambdaExpression)joinExpression).Parameters.ToList();
ILambdaExpressions expressionContext = sqlBuilder.QueryBuilder.LambdaExpressions;
expressionContext.MappingColumns = this.Context.MappingColumns;
expressionContext.MappingTables = this.Context.MappingTables;
expressionContext.MappingColumns = this.MappingColumns;
expressionContext.MappingTables = this.MappingTables;
if (this.Context.CurrentConnectionConfig.ConfigureExternalServices != null)
expressionContext.SqlFuncServices = this.Context.CurrentConnectionConfig.ConfigureExternalServices.SqlFuncServices;
expressionContext.Resolve(joinExpression, ResolveExpressType.Join);

View File

@@ -6,7 +6,7 @@ namespace SqlSugar
{
public partial interface IDbFirst
{
SqlSugarContext Context { get; set; }
ISqlSugarClient Context { get; set; }
IDbFirst SettingClassTemplate(Func<string, string> func);
IDbFirst SettingClassDescriptionTemplate(Func<string, string> func);
IDbFirst SettingPropertyTemplate(Func<string, string> func);

View File

@@ -11,7 +11,7 @@ namespace SqlSugar
{
public partial interface ISugarQueryable<T>
{
SqlSugarContext Context { get; set; }
ISqlSugarClient Context { get; set; }
ISqlBuilder SqlBuilder { get; set; }
QueryBuilder QueryBuilder { get; set; }
ISugarQueryable<T> Clone();

View File

@@ -6,13 +6,19 @@ using System.Threading.Tasks;
namespace SqlSugar
{
public interface ISqlSugarClient
public interface ISqlSugarClient: IDisposable
{
MappingTableList MappingTables { get; set; }
MappingColumnList MappingColumns { get; set; }
IgnoreColumnList IgnoreColumns { get; set; }
IgnoreColumnList IgnoreInsertColumns { get; set; }
QueueList Queues { get; set; }
IAdo Ado { get; }
AopProvider Aop { get; }
ICodeFirst CodeFirst { get; }
ISqlSugarClient Context { get; set; }
Guid ContextID { get; set; }
ConnectionConfig CurrentConnectionConfig { get; set; }
IDbFirst DbFirst { get; }
IDbMaintenance DbMaintenance { get; }

View File

@@ -11,23 +11,26 @@ namespace SqlSugar
public class SqlSugarClient : ISqlSugarClient
{
private ISqlSugarClient _Context = null;
public ISqlSugarClient Context { get => _Context; set => _Context = value; }
public SqlSugarClient(ConnectionConfig config)
{
_Context = new SqlSugarContext(config);
Init();
}
//public SqlSugarClient(List<ConnectionConfig> config)
//{
//}
public IAdo Ado => Context.Ado;
public IAdo Ado =>this.Context.Ado;
public AopProvider Aop => Context.Aop;
public AopProvider Aop => this.Context.Aop;
public ICodeFirst CodeFirst => Context.CodeFirst;
public ICodeFirst CodeFirst => this.Context.CodeFirst;
public Guid ContextID { get => this.Context.ContextID; set => this.Context.ContextID = value; }
public ConnectionConfig CurrentConnectionConfig { get => this.Context.CurrentConnectionConfig; set => this.Context.CurrentConnectionConfig=value; }
@@ -36,9 +39,9 @@ namespace SqlSugar
public IDbMaintenance DbMaintenance =>this.Context.DbMaintenance;
public EntityMaintenance EntityMaintenance { get =>this.EntityMaintenance; set =>this.EntityMaintenance=value; }
public EntityMaintenance EntityMaintenance { get =>this.Context.EntityMaintenance; set =>this.Context.EntityMaintenance=value; }
[Obsolete]
public EntityMaintenance EntityProvider { get =>this.EntityProvider ; set =>this.EntityProvider=value; }
public EntityMaintenance EntityProvider { get =>this.Context.EntityProvider ; set =>this.Context.EntityProvider=value; }
public bool IsSystemTablesConfig => this.Context.IsSystemTablesConfig;
@@ -50,6 +53,11 @@ namespace SqlSugar
public Dictionary<string, object> TempItems { get => this.Context.TempItems; set =>this.Context.TempItems=value; }
public IContextMethods Utilities { get => this.Context.Utilities; set => this.Context.Utilities = value; }
public MappingTableList MappingTables { get =>this.Context.MappingTables ; set => this.Context.MappingTables = value; }
public MappingColumnList MappingColumns { get => this.Context.MappingColumns; set => this.Context.MappingColumns = value; }
public IgnoreColumnList IgnoreColumns { get => this.Context.IgnoreColumns; set => this.Context.IgnoreColumns = value; }
public IgnoreColumnList IgnoreInsertColumns { get =>this.Context.IgnoreInsertColumns; set => this.Context.IgnoreInsertColumns=value; }
public QueueList Queues { get => this.Context.Queues; set => this.Context.Queues = value; }
public void AddQueue(string sql, object parsmeters = null)
{
@@ -78,7 +86,7 @@ namespace SqlSugar
public IDeleteable<T> Deleteable<T>(dynamic primaryKeyValue) where T : class, new()
{
return this.Deleteable<T>(primaryKeyValue);
return this.Context.Deleteable<T>(primaryKeyValue);
}
public IDeleteable<T> Deleteable<T>(dynamic[] primaryKeyValues) where T : class, new()
@@ -143,12 +151,12 @@ namespace SqlSugar
public IInsertable<T> Insertable<T>(List<T> insertObjs) where T : class, new()
{
return this.Insertable<T>(insertObjs);
return this.Context.Insertable<T>(insertObjs);
}
public IInsertable<T> Insertable<T>(T insertObj) where T : class, new()
{
return this.Insertable<T>(insertObj);
return this.Context.Insertable<T>(insertObj);
}
public IInsertable<T> Insertable<T>(T[] insertObjs) where T : class, new()
@@ -514,5 +522,28 @@ namespace SqlSugar
{
return this.Context.Updateable<T>(UpdateObjs);
}
private void Init()
{
if (this.MappingTables == null)
{
this.MappingTables = new MappingTableList();
}
if (this.MappingColumns == null)
{
this.MappingColumns = new MappingColumnList();
}
if (this.IgnoreColumns == null)
{
this.IgnoreColumns = new IgnoreColumnList();
}
if (this.IgnoreInsertColumns == null)
{
this.IgnoreInsertColumns = new IgnoreColumnList();
}
if (this.Queues == null)
{
this.Queues = new QueueList();
}
}
}
}

View File

@@ -15,7 +15,7 @@ namespace SqlSugar
/// ** date2017/1/2
/// ** email:610262374@qq.com
/// </summary>
public partial class SqlSugarContext : IDisposable, ISqlSugarClient
public partial class SqlSugarContext: ISqlSugarClient
{
#region Constructor
@@ -59,16 +59,16 @@ namespace SqlSugar
{
var result = InstanceFactory.GetAdo(this.Context.CurrentConnectionConfig);
this.ContextAdo = result;
result.Context = this.Context;
result.Context = this;
return result;
}
return this.Context._Ado;
return this._Ado;
}
}
#endregion
#region Aop Log Methods
public virtual AopProvider Aop { get { return new AopProvider(this.Context); } }
public virtual AopProvider Aop { get { return new AopProvider(this); } }
#endregion
#region Util Methods
@@ -85,7 +85,7 @@ namespace SqlSugar
if (ContextRewritableMethods == null)
{
ContextRewritableMethods = new ContextMethods();
ContextRewritableMethods.Context = this.Context;
ContextRewritableMethods.Context = this;
}
return ContextRewritableMethods;
}
@@ -430,7 +430,7 @@ namespace SqlSugar
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig);
sqlBuilder.Context = this.Context;
sqlBuilder.Context = this;
InitMppingInfo<T, T2>();
var types = new Type[] { typeof(T2) };
var queryable = InstanceFactory.GetQueryable<T, T2>(this.CurrentConnectionConfig);
@@ -439,7 +439,7 @@ namespace SqlSugar
queryable.QueryBuilder = InstanceFactory.GetQueryBuilder(this.CurrentConnectionConfig);
queryable.QueryBuilder.JoinQueryInfos = new List<JoinQueryInfo>();
queryable.QueryBuilder.Builder = sqlBuilder;
queryable.QueryBuilder.Context = this.Context;
queryable.QueryBuilder.Context = this;
queryable.QueryBuilder.EntityType = typeof(T);
queryable.QueryBuilder.LambdaExpressions = InstanceFactory.GetLambdaExpressions(this.CurrentConnectionConfig);
@@ -705,7 +705,7 @@ namespace SqlSugar
get
{
ICodeFirst codeFirst = InstanceFactory.GetCodeFirst(this.Context.CurrentConnectionConfig);
codeFirst.Context = this.Context;
codeFirst.Context = this;
return codeFirst;
}
}
@@ -716,13 +716,13 @@ namespace SqlSugar
{
get
{
if (this.Context._DbMaintenance == null)
if (this._DbMaintenance == null)
{
IDbMaintenance maintenance = InstanceFactory.GetDbMaintenance(this.Context.CurrentConnectionConfig);
this.Context._DbMaintenance = maintenance;
maintenance.Context = this.Context;
this._DbMaintenance = maintenance;
maintenance.Context = this;
}
return this.Context._DbMaintenance;
return this._DbMaintenance;
}
}
#endregion
@@ -738,14 +738,14 @@ namespace SqlSugar
{
get
{
if (this.Context._EntityProvider == null)
if (this._EntityProvider == null)
{
this.Context._EntityProvider = new EntityMaintenance();
this.Context._EntityProvider.Context = this.Context;
this._EntityProvider = new EntityMaintenance();
this._EntityProvider.Context = this;
}
return this.Context._EntityProvider;
return this._EntityProvider;
}
set { this.Context._EntityProvider = value; }
set { this._EntityProvider = value; }
}
#endregion
@@ -754,14 +754,14 @@ namespace SqlSugar
{
get
{
if (this.Context._QueryFilterProvider == null)
if (this._QueryFilterProvider == null)
{
this.Context._QueryFilterProvider = new QueryFilterProvider();
this.Context._QueryFilterProvider.Context = this.Context;
this._QueryFilterProvider = new QueryFilterProvider();
this._QueryFilterProvider.Context = this;
}
return this.Context._QueryFilterProvider;
return this._QueryFilterProvider;
}
set { this.Context._QueryFilterProvider = value; }
set { this._QueryFilterProvider = value; }
}
#endregion
@@ -771,20 +771,20 @@ namespace SqlSugar
{
get
{
if (this.Context._SimpleClient == null)
this.Context._SimpleClient = new SimpleClient(this.Context);
return this.Context._SimpleClient;
if (this._SimpleClient == null)
this._SimpleClient = new SimpleClient(this);
return this._SimpleClient;
}
}
public virtual SimpleClient<T> GetSimpleClient<T>() where T : class, new()
{
return new SimpleClient<T>(this.Context);
return new SimpleClient<T>(this);
}
public virtual SimpleClient GetSimpleClient()
{
if (this.Context._SimpleClient == null)
this.Context._SimpleClient = new SimpleClient(this.Context);
return this.Context._SimpleClient;
if (this._SimpleClient == null)
this._SimpleClient = new SimpleClient(this);
return this._SimpleClient;
}
#endregion
@@ -912,7 +912,7 @@ namespace SqlSugar
}
this.Queues.Add(sql, parsmeters);
}
public QueueList Queues = new QueueList();
public QueueList Queues { get; set; }
private T SaveQueuesProvider<T>(bool isTran, Func<string, List<SugarParameter>, T> func)
{