mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 23:13:42 +08:00
Code optimization
This commit is contained in:
parent
632cd6c896
commit
db2abc568d
@ -14,7 +14,7 @@ namespace OrmTest.Demo
|
||||
db.Ado.IsEnableLogEvent = true;
|
||||
db.Ado.LogEventStarting = (sql, pars) =>
|
||||
{
|
||||
Console.WriteLine(sql + "\r\n" + db.RewritableMethods.SerializeObject(pars));
|
||||
Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars));
|
||||
Console.WriteLine();
|
||||
};
|
||||
return db;
|
||||
|
@ -14,7 +14,7 @@ namespace OrmTest.Demo
|
||||
db.Ado.IsEnableLogEvent = true;
|
||||
db.Ado.LogEventStarting = (sql, pars) =>
|
||||
{
|
||||
Console.WriteLine(sql + "\r\n" + db.RewritableMethods.SerializeObject(pars));
|
||||
Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars));
|
||||
Console.WriteLine();
|
||||
};
|
||||
return db;
|
||||
|
@ -14,7 +14,7 @@ namespace OrmTest.Demo
|
||||
db.Ado.IsEnableLogEvent = true;
|
||||
db.Ado.LogEventStarting = (sql, pars) =>
|
||||
{
|
||||
Console.WriteLine(sql + "\r\n" + db.RewritableMethods.SerializeObject(pars));
|
||||
Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars));
|
||||
Console.WriteLine();
|
||||
};
|
||||
return db;
|
||||
|
@ -60,7 +60,7 @@ namespace OrmTest.UnitTest
|
||||
db.Ado.IsEnableLogEvent = true;
|
||||
db.Ado.LogEventStarting = (sql, pars) =>
|
||||
{
|
||||
Console.WriteLine(sql + "\r\n" + db.RewritableMethods.SerializeObject(pars));
|
||||
Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars));
|
||||
Console.WriteLine();
|
||||
};
|
||||
return db;
|
||||
|
@ -421,17 +421,17 @@ namespace SqlSugar
|
||||
public virtual dynamic SqlQueryDynamic(string sql, object parameters = null)
|
||||
{
|
||||
var dt = this.GetDataTable(sql, parameters);
|
||||
return dt == null ? null : this.Context.RewritableMethods.DataTableToDynamic(dt);
|
||||
return dt == null ? null : this.Context.Utilities.DataTableToDynamic(dt);
|
||||
}
|
||||
public virtual dynamic SqlQueryDynamic(string sql, params SugarParameter[] parameters)
|
||||
{
|
||||
var dt = this.GetDataTable(sql, parameters);
|
||||
return dt == null ? null : this.Context.RewritableMethods.DataTableToDynamic(dt);
|
||||
return dt == null ? null : this.Context.Utilities.DataTableToDynamic(dt);
|
||||
}
|
||||
public dynamic SqlQueryDynamic(string sql, List<SugarParameter> parameters)
|
||||
{
|
||||
var dt = this.GetDataTable(sql, parameters);
|
||||
return dt == null ? null : this.Context.RewritableMethods.DataTableToDynamic(dt);
|
||||
return dt == null ? null : this.Context.Utilities.DataTableToDynamic(dt);
|
||||
}
|
||||
public virtual DataTable GetDataTable(string sql, params SugarParameter[] parameters)
|
||||
{
|
||||
@ -536,7 +536,7 @@ namespace SqlSugar
|
||||
}
|
||||
else
|
||||
{
|
||||
action(sql, this.Context.RewritableMethods.SerializeObject(parameters.Select(it => new { key = it.ParameterName, value = it.Value.ObjToString() })));
|
||||
action(sql, this.Context.Utilities.SerializeObject(parameters.Select(it => new { key = it.ParameterName, value = it.Value.ObjToString() })));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -564,7 +564,7 @@ namespace SqlSugar
|
||||
}
|
||||
else
|
||||
{
|
||||
action(sql, this.Context.RewritableMethods.SerializeObject(parameters.Select(it => new { key = it.ParameterName, value = it.Value.ObjToString() })));
|
||||
action(sql, this.Context.Utilities.SerializeObject(parameters.Select(it => new { key = it.ParameterName, value = it.Value.ObjToString() })));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ namespace SqlSugar
|
||||
public virtual void InitTables(Type entityType)
|
||||
{
|
||||
|
||||
this.Context.RewritableMethods.RemoveCacheAll();
|
||||
this.Context.Utilities.RemoveCacheAll();
|
||||
this.Context.InitMppingInfo(entityType);
|
||||
if (!this.Context.DbMaintenance.IsAnySystemTablePermissions())
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ namespace SqlSugar
|
||||
protected List<T> GetEntityList<T>(SqlSugarClient context, IDataReader dataReader, string fields)
|
||||
{
|
||||
Type type = typeof(T);
|
||||
var cacheManager = context.RewritableMethods.GetCacheInstance<IDataReaderEntityBuilder<T>>();
|
||||
var cacheManager = context.Utilities.GetCacheInstance<IDataReaderEntityBuilder<T>>();
|
||||
string key = "DataReaderToList." + fields + context.CurrentConnectionConfig.DbType + type.FullName;
|
||||
IDataReaderEntityBuilder<T> entytyList = null;
|
||||
if (cacheManager.ContainsKey(key))
|
||||
|
@ -39,13 +39,13 @@ namespace SqlSugar
|
||||
|
||||
public void Init()
|
||||
{
|
||||
this.Context.RewritableMethods.RemoveCacheAll();
|
||||
this.Context.Utilities.RemoveCacheAll();
|
||||
if (!this.Context.DbMaintenance.IsAnySystemTablePermissions())
|
||||
{
|
||||
Check.Exception(true, "Dbfirst and Codefirst requires system table permissions");
|
||||
}
|
||||
this.TableInfoList = this.Context.RewritableMethods.TranslateCopy(this.Context.DbMaintenance.GetTableInfoList());
|
||||
var viewList = this.Context.RewritableMethods.TranslateCopy(this.Context.DbMaintenance.GetViewInfoList());
|
||||
this.TableInfoList = this.Context.Utilities.TranslateCopy(this.Context.DbMaintenance.GetTableInfoList());
|
||||
var viewList = this.Context.Utilities.TranslateCopy(this.Context.DbMaintenance.GetViewInfoList());
|
||||
if (viewList.IsValuable())
|
||||
{
|
||||
this.TableInfoList.AddRange(viewList);
|
||||
|
@ -41,7 +41,7 @@ namespace SqlSugar
|
||||
{
|
||||
string cacheKey = "DbMaintenanceProvider.GetIsIdentities" + this.SqlBuilder.GetNoTranslationColumnName(tableName).ToLower();
|
||||
cacheKey = GetCacheKey(cacheKey);
|
||||
return this.Context.RewritableMethods.GetCacheInstance<List<string>>().Func(cacheKey,
|
||||
return this.Context.Utilities.GetCacheInstance<List<string>>().Func(cacheKey,
|
||||
(cm, key) =>
|
||||
{
|
||||
return cm[cacheKey];
|
||||
@ -56,7 +56,7 @@ namespace SqlSugar
|
||||
{
|
||||
string cacheKey = "DbMaintenanceProvider.GetPrimaries" + this.SqlBuilder.GetNoTranslationColumnName(tableName).ToLower();
|
||||
cacheKey = GetCacheKey(cacheKey);
|
||||
return this.Context.RewritableMethods.GetCacheInstance<List<string>>().Func(cacheKey,
|
||||
return this.Context.Utilities.GetCacheInstance<List<string>>().Func(cacheKey,
|
||||
(cm, key) =>
|
||||
{
|
||||
return cm[cacheKey];
|
||||
@ -216,7 +216,7 @@ namespace SqlSugar
|
||||
#region Private
|
||||
private List<T> GetListOrCache<T>(string cacheKey, string sql)
|
||||
{
|
||||
return this.Context.RewritableMethods.GetCacheInstance<List<T>>().Func(cacheKey,
|
||||
return this.Context.Utilities.GetCacheInstance<List<T>>().Func(cacheKey,
|
||||
(cm, key) =>
|
||||
{
|
||||
return cm[cacheKey];
|
||||
|
@ -45,7 +45,7 @@ namespace SqlSugar
|
||||
var entityName = typeof(T).Name;
|
||||
IsAs = true;
|
||||
OldMappingTableList = this.Context.MappingTables;
|
||||
this.Context.MappingTables = this.Context.RewritableMethods.TranslateCopy(this.Context.MappingTables);
|
||||
this.Context.MappingTables = this.Context.Utilities.TranslateCopy(this.Context.MappingTables);
|
||||
this.Context.MappingTables.Add(entityName, tableName);
|
||||
return this; ;
|
||||
}
|
||||
@ -249,7 +249,7 @@ namespace SqlSugar
|
||||
}
|
||||
|
||||
private IDeleteable<T> CopyDeleteable() {
|
||||
var asyncContext = this.Context.CopyContext(this.Context.RewritableMethods.TranslateCopy(this.Context.CurrentConnectionConfig));
|
||||
var asyncContext = this.Context.CopyContext(this.Context.Utilities.TranslateCopy(this.Context.CurrentConnectionConfig));
|
||||
asyncContext.CurrentConnectionConfig.IsAutoCloseConnection = true;
|
||||
asyncContext.Ado.IsEnableLogEvent = this.Context.Ado.IsEnableLogEvent;
|
||||
asyncContext.Ado.LogEventStarting = this.Context.Ado.LogEventStarting;
|
||||
|
@ -18,7 +18,7 @@ namespace SqlSugar
|
||||
public EntityInfo GetEntityInfo(Type type)
|
||||
{
|
||||
string cacheKey = "GetEntityInfo" + type.FullName;
|
||||
return this.Context.RewritableMethods.GetCacheInstance<EntityInfo>().Func(cacheKey,
|
||||
return this.Context.Utilities.GetCacheInstance<EntityInfo>().Func(cacheKey,
|
||||
(cm, key) =>
|
||||
{
|
||||
return cm[cacheKey];
|
||||
|
@ -140,7 +140,7 @@ namespace SqlSugar
|
||||
var entityName = typeof(T).Name;
|
||||
IsAs = true;
|
||||
OldMappingTableList = this.Context.MappingTables;
|
||||
this.Context.MappingTables = this.Context.RewritableMethods.TranslateCopy(this.Context.MappingTables);
|
||||
this.Context.MappingTables = this.Context.Utilities.TranslateCopy(this.Context.MappingTables);
|
||||
this.Context.MappingTables.Add(entityName, tableName);
|
||||
return this; ;
|
||||
}
|
||||
@ -307,7 +307,7 @@ namespace SqlSugar
|
||||
}
|
||||
private IInsertable<T> CopyInsertable()
|
||||
{
|
||||
var asyncContext = this.Context.CopyContext(this.Context.RewritableMethods.TranslateCopy(this.Context.CurrentConnectionConfig));
|
||||
var asyncContext = this.Context.CopyContext(this.Context.Utilities.TranslateCopy(this.Context.CurrentConnectionConfig));
|
||||
asyncContext.CurrentConnectionConfig.IsAutoCloseConnection = true;
|
||||
asyncContext.Ado.IsEnableLogEvent = this.Context.Ado.IsEnableLogEvent;
|
||||
asyncContext.Ado.LogEventStarting = this.Context.Ado.LogEventStarting;
|
||||
|
@ -50,7 +50,7 @@ namespace SqlSugar
|
||||
var entityName = typeof(T2).Name;
|
||||
IsAs = true;
|
||||
OldMappingTableList = this.Context.MappingTables;
|
||||
this.Context.MappingTables = this.Context.RewritableMethods.TranslateCopy(this.Context.MappingTables);
|
||||
this.Context.MappingTables = this.Context.Utilities.TranslateCopy(this.Context.MappingTables);
|
||||
this.Context.MappingTables.Add(entityName, tableName);
|
||||
this.QueryableMappingTableList = this.Context.MappingTables;
|
||||
return this;
|
||||
@ -60,7 +60,7 @@ namespace SqlSugar
|
||||
var entityName = typeof(T).Name;
|
||||
IsAs = true;
|
||||
OldMappingTableList = this.Context.MappingTables;
|
||||
this.Context.MappingTables = this.Context.RewritableMethods.TranslateCopy(this.Context.MappingTables);
|
||||
this.Context.MappingTables = this.Context.Utilities.TranslateCopy(this.Context.MappingTables);
|
||||
this.Context.MappingTables.Add(entityName, tableName);
|
||||
this.QueryableMappingTableList = this.Context.MappingTables;
|
||||
return this;
|
||||
@ -486,15 +486,15 @@ namespace SqlSugar
|
||||
}
|
||||
public virtual string ToJson()
|
||||
{
|
||||
return this.Context.RewritableMethods.SerializeObject(this.ToList());
|
||||
return this.Context.Utilities.SerializeObject(this.ToList());
|
||||
}
|
||||
public virtual string ToJsonPage(int pageIndex, int pageSize)
|
||||
{
|
||||
return this.Context.RewritableMethods.SerializeObject(this.ToPageList(pageIndex, pageSize));
|
||||
return this.Context.Utilities.SerializeObject(this.ToPageList(pageIndex, pageSize));
|
||||
}
|
||||
public virtual string ToJsonPage(int pageIndex, int pageSize, ref int totalNumber)
|
||||
{
|
||||
return this.Context.RewritableMethods.SerializeObject(this.ToPageList(pageIndex, pageSize, ref totalNumber));
|
||||
return this.Context.Utilities.SerializeObject(this.ToPageList(pageIndex, pageSize, ref totalNumber));
|
||||
}
|
||||
|
||||
public virtual DataTable ToDataTable()
|
||||
@ -948,11 +948,11 @@ namespace SqlSugar
|
||||
{
|
||||
if (typeof(TResult) == typeof(ExpandoObject))
|
||||
{
|
||||
return this.Context.RewritableMethods.DataReaderToExpandoObjectList(dataReader) as List<TResult>;
|
||||
return this.Context.Utilities.DataReaderToExpandoObjectList(dataReader) as List<TResult>;
|
||||
}
|
||||
if (entityType.IsAnonymousType() || isComplexModel)
|
||||
{
|
||||
result = this.Context.RewritableMethods.DataReaderToDynamicList<TResult>(dataReader);
|
||||
result = this.Context.Utilities.DataReaderToDynamicList<TResult>(dataReader);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1034,7 +1034,7 @@ namespace SqlSugar
|
||||
}
|
||||
private ISugarQueryable<T> CopyQueryable()
|
||||
{
|
||||
var asyncContext = this.Context.CopyContext(this.Context.RewritableMethods.TranslateCopy(this.Context.CurrentConnectionConfig));
|
||||
var asyncContext = this.Context.CopyContext(this.Context.Utilities.TranslateCopy(this.Context.CurrentConnectionConfig));
|
||||
asyncContext.CurrentConnectionConfig.IsAutoCloseConnection = true;
|
||||
asyncContext.Ado.IsEnableLogEvent = this.Context.Ado.IsEnableLogEvent;
|
||||
asyncContext.Ado.LogEventStarting = this.Context.Ado.LogEventStarting;
|
||||
|
@ -48,7 +48,7 @@ namespace SqlSugar
|
||||
var entityName = typeof(T).Name;
|
||||
IsAs = true;
|
||||
OldMappingTableList = this.Context.MappingTables;
|
||||
this.Context.MappingTables = this.Context.RewritableMethods.TranslateCopy(this.Context.MappingTables);
|
||||
this.Context.MappingTables = this.Context.Utilities.TranslateCopy(this.Context.MappingTables);
|
||||
this.Context.MappingTables.Add(entityName, tableName);
|
||||
return this; ;
|
||||
}
|
||||
@ -311,7 +311,7 @@ namespace SqlSugar
|
||||
}
|
||||
private IUpdateable<T> CopyUpdateable()
|
||||
{
|
||||
var asyncContext = this.Context.CopyContext(this.Context.RewritableMethods.TranslateCopy(this.Context.CurrentConnectionConfig));
|
||||
var asyncContext = this.Context.CopyContext(this.Context.Utilities.TranslateCopy(this.Context.CurrentConnectionConfig));
|
||||
asyncContext.CurrentConnectionConfig.IsAutoCloseConnection = true;
|
||||
asyncContext.Ado.IsEnableLogEvent = this.Context.Ado.IsEnableLogEvent;
|
||||
asyncContext.Ado.LogEventStarting = this.Context.Ado.LogEventStarting;
|
||||
|
@ -97,7 +97,7 @@ namespace SqlSugar
|
||||
public void InitMppingInfo(Type type)
|
||||
{
|
||||
string cacheKey = "Context.InitAttributeMappingTables" + type.FullName;
|
||||
var entityInfo = this.Context.RewritableMethods.GetCacheInstance<EntityInfo>().Func(cacheKey,
|
||||
var entityInfo = this.Context.Utilities.GetCacheInstance<EntityInfo>().Func(cacheKey,
|
||||
(cm, key) =>
|
||||
{
|
||||
var cacheInfo = cm[key];
|
||||
|
@ -170,7 +170,7 @@ namespace SqlSugar
|
||||
{
|
||||
string cacheKey = "DbMaintenanceProvider.GetColumnInfosByTableName." + this.SqlBuilder.GetNoTranslationColumnName(tableName).ToLower();
|
||||
cacheKey = GetCacheKey(cacheKey);
|
||||
return this.Context.RewritableMethods.GetCacheInstance<List<DbColumnInfo>>().Func(cacheKey,
|
||||
return this.Context.Utilities.GetCacheInstance<List<DbColumnInfo>>().Func(cacheKey,
|
||||
(cm, key) =>
|
||||
{
|
||||
return cm[cacheKey];
|
||||
@ -211,7 +211,7 @@ namespace SqlSugar
|
||||
{
|
||||
string cacheKey = "DbMaintenanceProvider.GetPrimaryKeyByTableNames." + this.SqlBuilder.GetNoTranslationColumnName(tableName).ToLower();
|
||||
cacheKey = GetCacheKey(cacheKey);
|
||||
return this.Context.RewritableMethods.GetCacheInstance<List<string>>().Func(cacheKey,
|
||||
return this.Context.Utilities.GetCacheInstance<List<string>>().Func(cacheKey,
|
||||
(cm, key) =>
|
||||
{
|
||||
return cm[cacheKey];
|
||||
|
@ -168,7 +168,7 @@ namespace SqlSugar
|
||||
{
|
||||
string cacheKey = "DbMaintenanceProvider.GetColumnInfosByTableName." + this.SqlBuilder.GetNoTranslationColumnName(tableName).ToLower();
|
||||
cacheKey = GetCacheKey(cacheKey);
|
||||
return this.Context.RewritableMethods.GetCacheInstance<List<DbColumnInfo>>().Func(cacheKey,
|
||||
return this.Context.Utilities.GetCacheInstance<List<DbColumnInfo>>().Func(cacheKey,
|
||||
(cm, key) =>
|
||||
{
|
||||
return cm[cacheKey];
|
||||
@ -260,7 +260,7 @@ namespace SqlSugar
|
||||
}
|
||||
private List<T> GetListOrCache<T>(string cacheKey, string sql)
|
||||
{
|
||||
return this.Context.RewritableMethods.GetCacheInstance<List<T>>().Func(cacheKey,
|
||||
return this.Context.Utilities.GetCacheInstance<List<T>>().Func(cacheKey,
|
||||
(cm, key) =>
|
||||
{
|
||||
return cm[cacheKey];
|
||||
|
@ -60,23 +60,21 @@ namespace SqlSugar
|
||||
#endregion
|
||||
|
||||
#region Rewritable Methods
|
||||
/// <summary>
|
||||
/// Rewritable Methods
|
||||
/// </summary>
|
||||
[Obsolete("db.IRewritableMethods is Obsolete,Use db.Utilities")]
|
||||
public virtual IRewritableMethods RewritableMethods
|
||||
{
|
||||
get { return this.Utilities; }
|
||||
set { this.Utilities = value; }
|
||||
}
|
||||
public virtual IRewritableMethods Utilities
|
||||
{
|
||||
get
|
||||
{
|
||||
if (base._RewritableMethods == null)
|
||||
{
|
||||
base._RewritableMethods = new RewritableMethods();
|
||||
}
|
||||
return _RewritableMethods;
|
||||
}
|
||||
set
|
||||
{
|
||||
base._RewritableMethods = value;
|
||||
}
|
||||
set { base._RewritableMethods = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -152,7 +150,7 @@ namespace SqlSugar
|
||||
}
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7> Queryable<T, T2, T3, T4, T5, T6, T7>(Expression<Func<T, T2, T3, T4, T5, T6, T7, object[]>> joinExpression) where T : class, new()
|
||||
{
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6,T7>();
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6, T7>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) };
|
||||
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7>(base.CurrentConnectionConfig);
|
||||
base.CreateQueryJoin(joinExpression, types, queryable);
|
||||
@ -160,7 +158,7 @@ namespace SqlSugar
|
||||
}
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> Queryable<T, T2, T3, T4, T5, T6, T7, T8>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, object[]>> joinExpression) where T : class, new()
|
||||
{
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6,T7, T8>();
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) };
|
||||
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8>(base.CurrentConnectionConfig);
|
||||
base.CreateQueryJoin(joinExpression, types, queryable);
|
||||
@ -169,7 +167,7 @@ namespace SqlSugar
|
||||
#region 9-12
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, object[]>> joinExpression) where T : class, new()
|
||||
{
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6,T7, T8, T9>();
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) };
|
||||
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(base.CurrentConnectionConfig);
|
||||
base.CreateQueryJoin(joinExpression, types, queryable);
|
||||
@ -177,7 +175,7 @@ namespace SqlSugar
|
||||
}
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, object[]>> joinExpression) where T : class, new()
|
||||
{
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6, T7,T8, T9, T10>();
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10) };
|
||||
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(base.CurrentConnectionConfig);
|
||||
base.CreateQueryJoin(joinExpression, types, queryable);
|
||||
@ -185,7 +183,7 @@ namespace SqlSugar
|
||||
}
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, object[]>> joinExpression) where T : class, new()
|
||||
{
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6,T7, T8, T9, T10, T11>();
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) };
|
||||
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(base.CurrentConnectionConfig);
|
||||
base.CreateQueryJoin(joinExpression, types, queryable);
|
||||
@ -193,7 +191,7 @@ namespace SqlSugar
|
||||
}
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, object[]>> joinExpression) where T : class, new()
|
||||
{
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6,T7, T8, T9, T10, T11, T12>();
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) };
|
||||
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(base.CurrentConnectionConfig);
|
||||
base.CreateQueryJoin(joinExpression, types, queryable);
|
||||
@ -352,7 +350,7 @@ namespace SqlSugar
|
||||
{
|
||||
InitMppingInfo<T>();
|
||||
Check.Exception(columnDictionary == null || columnDictionary.Count == 0, "Insertable.columnDictionary can't be null");
|
||||
var insertObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(columnDictionary));
|
||||
var insertObject = this.Utilities.DeserializeObject<T>(this.Utilities.SerializeObject(columnDictionary));
|
||||
var columns = columnDictionary.Select(it => it.Key).ToList();
|
||||
return this.Insertable(insertObject).InsertColumns(it => columns.Any(c => it.Equals(c, StringComparison.CurrentCultureIgnoreCase))); ;
|
||||
}
|
||||
@ -367,7 +365,7 @@ namespace SqlSugar
|
||||
{
|
||||
var columns = ((object)insertDynamicObject).GetType().GetProperties().Select(it => it.Name).ToList();
|
||||
Check.Exception(columns.IsNullOrEmpty(), "Insertable.updateDynamicObject can't be null");
|
||||
T insertObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(insertDynamicObject));
|
||||
T insertObject = this.Utilities.DeserializeObject<T>(this.Utilities.SerializeObject(insertDynamicObject));
|
||||
return this.Insertable(insertObject).InsertColumns(it => columns.Any(c => it.Equals(c, StringComparison.CurrentCultureIgnoreCase)));
|
||||
}
|
||||
}
|
||||
@ -436,7 +434,7 @@ namespace SqlSugar
|
||||
{
|
||||
InitMppingInfo<T>();
|
||||
Check.Exception(columnDictionary == null || columnDictionary.Count == 0, "Updateable.columnDictionary can't be null");
|
||||
var updateObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(columnDictionary));
|
||||
var updateObject = this.Utilities.DeserializeObject<T>(this.Utilities.SerializeObject(columnDictionary));
|
||||
var columns = columnDictionary.Select(it => it.Key).ToList();
|
||||
return this.Updateable(updateObject).UpdateColumns(it => columns.Any(c => it.Equals(c, StringComparison.CurrentCultureIgnoreCase))); ;
|
||||
}
|
||||
@ -451,7 +449,7 @@ namespace SqlSugar
|
||||
{
|
||||
var columns = ((object)updateDynamicObject).GetType().GetProperties().Select(it => it.Name).ToList();
|
||||
Check.Exception(columns.IsNullOrEmpty(), "Updateable.updateDynamicObject can't be null");
|
||||
T updateObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(updateDynamicObject));
|
||||
T updateObject = this.Utilities.DeserializeObject<T>(this.Utilities.SerializeObject(updateDynamicObject));
|
||||
return this.Updateable(updateObject).UpdateColumns(it => columns.Any(c => it.Equals(c, StringComparison.CurrentCultureIgnoreCase))); ;
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace SqlSugar
|
||||
var parsStr = string.Empty; ;
|
||||
if (pars != null)
|
||||
{
|
||||
parsStr = context.RewritableMethods.SerializeObject(pars);
|
||||
parsStr = context.Utilities.SerializeObject(pars);
|
||||
}
|
||||
var reval = GetLineMessage("message", message) + GetLineMessage("function", parsStr);
|
||||
return reval;
|
||||
|
@ -14,7 +14,7 @@ namespace OrmTest.Demo
|
||||
db.Ado.IsEnableLogEvent = true;
|
||||
db.Ado.LogEventStarting = (sql, pars) =>
|
||||
{
|
||||
Console.WriteLine(sql + "\r\n" + db.RewritableMethods.SerializeObject(pars));
|
||||
Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars));
|
||||
Console.WriteLine();
|
||||
};
|
||||
return db;
|
||||
|
Loading…
Reference in New Issue
Block a user