mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-07 22:27:58 +08:00
解决Storageable缓慢的问题
This commit is contained in:
parent
ddcff6a316
commit
b8c2028ac7
@ -31,6 +31,13 @@ namespace SqlSugar
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Expression<Func<T, bool>> queryableWhereExp;
|
||||||
|
public IStorageable<T> Where(Expression<Func<T, bool>> exp)
|
||||||
|
{
|
||||||
|
this.queryableWhereExp = exp;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public IStorageable<T> SplitInsert(Func<StorageableInfo<T>, bool> conditions, string message = null)
|
public IStorageable<T> SplitInsert(Func<StorageableInfo<T>, bool> conditions, string message = null)
|
||||||
{
|
{
|
||||||
whereFuncs.Add(new KeyValuePair<StorageType, Func<StorageableInfo<T>, bool>, string>(StorageType.Insert, conditions, message));
|
whereFuncs.Add(new KeyValuePair<StorageType, Func<StorageableInfo<T>, bool>, string>(StorageType.Insert, conditions, message));
|
||||||
@ -299,13 +306,20 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
if (whereColumns.Count > 0)
|
if (whereColumns.Count > 0)
|
||||||
{
|
{
|
||||||
this.Context.Utilities.PageEach(allDatas, 200, itemList =>
|
if (queryableWhereExp == null)
|
||||||
{
|
{
|
||||||
List<IConditionalModel> conditList = new List<IConditionalModel>();
|
this.Context.Utilities.PageEach(allDatas, 200, itemList =>
|
||||||
SetConditList(itemList, whereColumns, conditList);
|
{
|
||||||
var addItem = this.Context.Queryable<T>().AS(asname).Where(conditList).ToList();
|
List<IConditionalModel> conditList = new List<IConditionalModel>();
|
||||||
this.dbDataList.AddRange(addItem);
|
SetConditList(itemList, whereColumns, conditList);
|
||||||
});
|
var addItem = this.Context.Queryable<T>().AS(asname).Where(conditList).ToList();
|
||||||
|
this.dbDataList.AddRange(addItem);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.dbDataList.AddRange(this.Context.Queryable<T>().AS(asname).Where(queryableWhereExp).ToList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.whereExpression = columns;
|
this.whereExpression = columns;
|
||||||
return this;
|
return this;
|
||||||
|
@ -8,6 +8,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public interface IStorageable<T> where T : class, new()
|
public interface IStorageable<T> where T : class, new()
|
||||||
{
|
{
|
||||||
|
IStorageable<T> Where(Expression<Func<T, bool>> exp);
|
||||||
IStorageable<T> WhereColumns(Expression<Func<T, object>> columns);
|
IStorageable<T> WhereColumns(Expression<Func<T, object>> columns);
|
||||||
IStorageable<T> WhereColumns(Expression<Func<T, object>> columns,Func<DateTime,string> formatTime);
|
IStorageable<T> WhereColumns(Expression<Func<T, object>> columns,Func<DateTime,string> formatTime);
|
||||||
IStorageable<T> WhereColumns(string [] columns);
|
IStorageable<T> WhereColumns(string [] columns);
|
||||||
|
Loading…
Reference in New Issue
Block a user