mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-09 02:44:58 +08:00
Add Queryable.WithCache
This commit is contained in:
@@ -22,6 +22,8 @@ namespace SqlSugar
|
||||
public ISqlBuilder SqlBuilder { get; set; }
|
||||
public MappingTableList OldMappingTableList { get; set; }
|
||||
public MappingTableList QueryableMappingTableList { get; set; }
|
||||
public bool IsCache { get; set; }
|
||||
public int CacheTime { get; set; }
|
||||
public bool IsAs { get; set; }
|
||||
public QueryBuilder QueryBuilder
|
||||
{
|
||||
@@ -584,7 +586,12 @@ namespace SqlSugar
|
||||
RestoreMapping();
|
||||
return new KeyValuePair<string, List<SugarParameter>>(sql, QueryBuilder.Parameters);
|
||||
}
|
||||
|
||||
public ISugarQueryable<T> WithCache(int cacheDurationInSeconds = int.MaxValue)
|
||||
{
|
||||
this.IsCache = true;
|
||||
this.CacheTime = cacheDurationInSeconds;
|
||||
return this;
|
||||
}
|
||||
#region Async methods
|
||||
public Task<T> SingleAsync()
|
||||
{
|
||||
@@ -1298,6 +1305,12 @@ namespace SqlSugar
|
||||
base.With(withString);
|
||||
return this;
|
||||
}
|
||||
public new ISugarQueryable<T, T2> WithCache(int cacheDurationInSeconds = int.MaxValue)
|
||||
{
|
||||
this.IsCache = true;
|
||||
this.CacheTime = cacheDurationInSeconds;
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
@@ -1507,6 +1520,12 @@ namespace SqlSugar
|
||||
base.With(withString);
|
||||
return this;
|
||||
}
|
||||
public new ISugarQueryable<T, T2, T3> WithCache(int cacheDurationInSeconds = int.MaxValue)
|
||||
{
|
||||
this.IsCache = true;
|
||||
this.CacheTime = cacheDurationInSeconds;
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
@@ -1737,6 +1756,12 @@ namespace SqlSugar
|
||||
base.With(withString);
|
||||
return this;
|
||||
}
|
||||
public new ISugarQueryable<T, T2, T3, T4> WithCache(int cacheDurationInSeconds = int.MaxValue)
|
||||
{
|
||||
this.IsCache = true;
|
||||
this.CacheTime = cacheDurationInSeconds;
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
@@ -1993,6 +2018,12 @@ namespace SqlSugar
|
||||
base.With(withString);
|
||||
return this;
|
||||
}
|
||||
public new ISugarQueryable<T, T2, T3, T4, T5> WithCache(int cacheDurationInSeconds = int.MaxValue)
|
||||
{
|
||||
this.IsCache = true;
|
||||
this.CacheTime = cacheDurationInSeconds;
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
@@ -2275,6 +2306,12 @@ namespace SqlSugar
|
||||
base.With(withString);
|
||||
return this;
|
||||
}
|
||||
public new ISugarQueryable<T, T2, T3, T4, T5, T6> WithCache(int cacheDurationInSeconds = int.MaxValue)
|
||||
{
|
||||
this.IsCache = true;
|
||||
this.CacheTime = cacheDurationInSeconds;
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
@@ -2584,6 +2621,12 @@ namespace SqlSugar
|
||||
base.With(withString);
|
||||
return this;
|
||||
}
|
||||
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7> WithCache(int cacheDurationInSeconds = int.MaxValue)
|
||||
{
|
||||
this.IsCache = true;
|
||||
this.CacheTime = cacheDurationInSeconds;
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
@@ -2919,6 +2962,12 @@ namespace SqlSugar
|
||||
base.With(withString);
|
||||
return this;
|
||||
}
|
||||
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> WithCache(int cacheDurationInSeconds = int.MaxValue)
|
||||
{
|
||||
this.IsCache = true;
|
||||
this.CacheTime = cacheDurationInSeconds;
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
@@ -3277,6 +3326,12 @@ namespace SqlSugar
|
||||
base.With(withString);
|
||||
return this;
|
||||
}
|
||||
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> WithCache(int cacheDurationInSeconds = int.MaxValue)
|
||||
{
|
||||
this.IsCache = true;
|
||||
this.CacheTime = cacheDurationInSeconds;
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
@@ -3659,6 +3714,12 @@ namespace SqlSugar
|
||||
base.With(withString);
|
||||
return this;
|
||||
}
|
||||
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> WithCache(int cacheDurationInSeconds = int.MaxValue)
|
||||
{
|
||||
this.IsCache = true;
|
||||
this.CacheTime = cacheDurationInSeconds;
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
@@ -4066,6 +4127,12 @@ namespace SqlSugar
|
||||
base.With(withString);
|
||||
return this;
|
||||
}
|
||||
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> WithCache(int cacheDurationInSeconds = int.MaxValue)
|
||||
{
|
||||
this.IsCache = true;
|
||||
this.CacheTime = cacheDurationInSeconds;
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
@@ -4498,6 +4565,11 @@ namespace SqlSugar
|
||||
base.With(withString);
|
||||
return this;
|
||||
}
|
||||
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> WithCache(int cacheDurationInSeconds=int.MaxValue) {
|
||||
this.IsCache = true;
|
||||
this.CacheTime = cacheDurationInSeconds;
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -121,6 +121,7 @@ namespace SqlSugar
|
||||
Task<List<T>> ToPageListAsync(int pageIndex, int pageSize);
|
||||
List<T> ToPageList(int pageIndex, int pageSize, ref int totalNumber);
|
||||
Task<KeyValuePair<List<T>,int>> ToPageListAsync(int pageIndex, int pageSize, int totalNumber);
|
||||
ISugarQueryable<T> WithCache(int cacheDurationInSeconds = int.MaxValue);
|
||||
void Clear();
|
||||
}
|
||||
public partial interface ISugarQueryable<T, T2> : ISugarQueryable<T>
|
||||
@@ -176,6 +177,7 @@ namespace SqlSugar
|
||||
new ISugarQueryable<T, T2> AddParameters(List<SugarParameter> parameters);
|
||||
new ISugarQueryable<T,T2> AddJoinInfo(string tableName, string shortName, string joinWhere, JoinType type = JoinType.Left);
|
||||
new ISugarQueryable<T,T2> With(string withString);
|
||||
new ISugarQueryable<T,T2> WithCache(int cacheDurationInSeconds = int.MaxValue);
|
||||
#endregion
|
||||
}
|
||||
public partial interface ISugarQueryable<T, T2, T3> : ISugarQueryable<T>
|
||||
@@ -232,6 +234,7 @@ namespace SqlSugar
|
||||
new ISugarQueryable<T, T2,T3> AddParameters(List<SugarParameter> parameters);
|
||||
new ISugarQueryable<T, T2,T3> AddJoinInfo(string tableName, string shortName, string joinWhere, JoinType type = JoinType.Left);
|
||||
new ISugarQueryable<T, T2,T3> With(string withString);
|
||||
new ISugarQueryable<T, T2,T3> WithCache(int cacheDurationInSeconds = int.MaxValue);
|
||||
#endregion
|
||||
}
|
||||
public partial interface ISugarQueryable<T, T2, T3, T4> : ISugarQueryable<T>
|
||||
@@ -293,6 +296,7 @@ namespace SqlSugar
|
||||
new ISugarQueryable<T, T2, T3,T4> AddParameters(List<SugarParameter> parameters);
|
||||
new ISugarQueryable<T, T2, T3,T4> AddJoinInfo(string tableName, string shortName, string joinWhere, JoinType type = JoinType.Left);
|
||||
new ISugarQueryable<T, T2, T3,T4> With(string withString);
|
||||
new ISugarQueryable<T, T2, T3,T4> WithCache(int cacheDurationInSeconds = int.MaxValue);
|
||||
#endregion
|
||||
}
|
||||
public partial interface ISugarQueryable<T, T2, T3, T4, T5> : ISugarQueryable<T>
|
||||
@@ -360,6 +364,7 @@ namespace SqlSugar
|
||||
new ISugarQueryable<T, T2, T3, T4,T5> AddParameters(List<SugarParameter> parameters);
|
||||
new ISugarQueryable<T, T2, T3, T4,T5> AddJoinInfo(string tableName, string shortName, string joinWhere, JoinType type = JoinType.Left);
|
||||
new ISugarQueryable<T, T2, T3, T4,T5> With(string withString);
|
||||
new ISugarQueryable<T, T2, T3, T4,T5> WithCache(int cacheDurationInSeconds = int.MaxValue);
|
||||
#endregion
|
||||
}
|
||||
public partial interface ISugarQueryable<T, T2, T3, T4, T5, T6> : ISugarQueryable<T>
|
||||
@@ -431,6 +436,7 @@ namespace SqlSugar
|
||||
new ISugarQueryable<T, T2, T3, T4, T5,T6> AddParameters(List<SugarParameter> parameters);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5,T6> AddJoinInfo(string tableName, string shortName, string joinWhere, JoinType type = JoinType.Left);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5,T6> With(string withString);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5,T6> WithCache(int cacheDurationInSeconds = int.MaxValue);
|
||||
#endregion
|
||||
}
|
||||
public partial interface ISugarQueryable<T, T2, T3, T4, T5, T6, T7> : ISugarQueryable<T>
|
||||
@@ -507,6 +513,7 @@ namespace SqlSugar
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6,T7> AddParameters(List<SugarParameter> parameters);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6,T7> AddJoinInfo(string tableName, string shortName, string joinWhere, JoinType type = JoinType.Left);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6,T7> With(string withString);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6,T7> WithCache(int cacheDurationInSeconds = int.MaxValue);
|
||||
#endregion
|
||||
}
|
||||
public partial interface ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> : ISugarQueryable<T>
|
||||
@@ -588,6 +595,7 @@ namespace SqlSugar
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7,T8> AddParameters(List<SugarParameter> parameters);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7,T8> AddJoinInfo(string tableName, string shortName, string joinWhere, JoinType type = JoinType.Left);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7,T8> With(string withString);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7,T8> WithCache(int cacheDurationInSeconds = int.MaxValue);
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -676,6 +684,7 @@ namespace SqlSugar
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8,T9> AddParameters(List<SugarParameter> parameters);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8,T9> AddJoinInfo(string tableName, string shortName, string joinWhere, JoinType type = JoinType.Left);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8,T9> With(string withString);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8,T9> WithCache(int cacheDurationInSeconds = int.MaxValue);
|
||||
#endregion
|
||||
}
|
||||
public partial interface ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8,T9,T10> : ISugarQueryable<T>
|
||||
@@ -767,6 +776,7 @@ namespace SqlSugar
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9,T10> AddParameters(List<SugarParameter> parameters);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9,T10> AddJoinInfo(string tableName, string shortName, string joinWhere, JoinType type = JoinType.Left);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9,T10> With(string withString);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9,T10> WithCache(int cacheDurationInSeconds = int.MaxValue);
|
||||
#endregion
|
||||
}
|
||||
public partial interface ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8,T9,T10,T11> : ISugarQueryable<T>
|
||||
@@ -863,6 +873,7 @@ namespace SqlSugar
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10,T11> AddParameters(List<SugarParameter> parameters);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10,T11> AddJoinInfo(string tableName, string shortName, string joinWhere, JoinType type = JoinType.Left);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10,T11> With(string withString);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10,T11> WithCache(int cacheDurationInSeconds = int.MaxValue);
|
||||
#endregion
|
||||
}
|
||||
public partial interface ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8,T9,T10,T11,T12> : ISugarQueryable<T>
|
||||
@@ -964,7 +975,8 @@ namespace SqlSugar
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,T12> AddParameters(List<SugarParameter> parameters);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,T12> AddJoinInfo(string tableName, string shortName, string joinWhere, JoinType type = JoinType.Left);
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,T12> With(string withString);
|
||||
#endregion ,T12
|
||||
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,T12> WithCache(int cacheDurationInSeconds = int.MaxValue);
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user