diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/SaveableProvider/Storageable.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/SaveableProvider/Storageable.cs index 0c161b024..57dfd155b 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/SaveableProvider/Storageable.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/SaveableProvider/Storageable.cs @@ -31,6 +31,13 @@ namespace SqlSugar }).ToList(); } + Expression> queryableWhereExp; + public IStorageable TableDataRange(Expression> exp) + { + this.queryableWhereExp = exp; + return this; + } + public IStorageable SplitInsert(Func, bool> conditions, string message = null) { whereFuncs.Add(new KeyValuePair, bool>, string>(StorageType.Insert, conditions, message)); @@ -299,13 +306,20 @@ namespace SqlSugar } if (whereColumns.Count > 0) { - this.Context.Utilities.PageEach(allDatas, 200, itemList => + if (queryableWhereExp == null) { - List conditList = new List(); - SetConditList(itemList, whereColumns, conditList); - var addItem = this.Context.Queryable().AS(asname).Where(conditList).ToList(); - this.dbDataList.AddRange(addItem); - }); + this.Context.Utilities.PageEach(allDatas, 200, itemList => + { + List conditList = new List(); + SetConditList(itemList, whereColumns, conditList); + var addItem = this.Context.Queryable().AS(asname).Where(conditList).ToList(); + this.dbDataList.AddRange(addItem); + }); + } + else + { + this.dbDataList.AddRange(this.Context.Queryable().AS(asname).Where(queryableWhereExp).ToList()); + } } this.whereExpression = columns; return this; diff --git a/Src/Asp.NetCore2/SqlSugar/Interface/IStorageable.cs b/Src/Asp.NetCore2/SqlSugar/Interface/IStorageable.cs index 3c52d6da4..0897a7a5b 100644 --- a/Src/Asp.NetCore2/SqlSugar/Interface/IStorageable.cs +++ b/Src/Asp.NetCore2/SqlSugar/Interface/IStorageable.cs @@ -8,6 +8,7 @@ namespace SqlSugar { public interface IStorageable where T : class, new() { + IStorageable TableDataRange(Expression> exp); IStorageable WhereColumns(Expression> columns); IStorageable WhereColumns(Expression> columns,Func formatTime); IStorageable WhereColumns(string [] columns);