Browse Source

Update Core

pull/8/head
sunkaixuna 3 years ago
parent
commit
3396e12c0a
  1. 8
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs
  2. 59
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs
  3. 1
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs
  4. 9
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs
  5. 4
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Infrastructure/ContextMethods.cs
  6. 1
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Interface/IDeleteable.cs
  7. 11
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Interface/IQueryable.cs
  8. 2
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/SqlSugar.csproj
  9. 2
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/SqlSugarForCore.nuspec
  10. 2
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/SqlSugarForCoreMySqlConnector.nuspec
  11. 2
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/SqlSugarForCoreNoDrive.nuspec

8
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs

@ -250,6 +250,14 @@ namespace SqlSugar
};
return this;
}
public IDeleteable<T> EnableQueryFilter()
{
var queryable = this.Context.Queryable<T>();
queryable.QueryBuilder.LambdaExpressions.ParameterIndex= 1000;
var sqlable= queryable.ToSql();
this.Where(Regex.Split(sqlable.Key," Where ",RegexOptions.IgnoreCase).Last(), sqlable.Value);
return this;
}
public IDeleteable<T> RemoveDataCache(string likeString)
{
this.RemoveCacheFunc = () =>

59
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs

@ -73,6 +73,7 @@ namespace SqlSugar
{
var queryable = this.Context.Queryable<object>().Select<T>().WithCacheIF(IsCache, CacheTime);
CopyQueryBuilder(queryable.QueryBuilder);
((QueryableProvider<T>)queryable).CacheKey = this.CacheKey;
((QueryableProvider<T>)queryable).MapperAction = this.MapperAction;
((QueryableProvider<T>)queryable).MapperActionWithCache = this.MapperActionWithCache;
((QueryableProvider<T>)queryable).Mappers = this.Mappers;
@ -199,7 +200,7 @@ namespace SqlSugar
public virtual ISugarQueryable<T> Mapper(Action<T, MapperCache<T>> mapperAction)
{
this.MapperActionWithCache = mapperAction;
this.MapperActionWithCache += mapperAction;
return this;
}
public ISugarQueryable<T> Mapper<TObject>(Expression<Func<T, TObject>> mapperObject, Expression<Func<T, object>> mainField, Expression<Func<T, object>> childField)
@ -2765,6 +2766,12 @@ namespace SqlSugar
QueryBuilder.IsDistinct = true;
return this;
}
public new ISugarQueryable<T, T2> Take(int num)
{
QueryBuilder.Take = num;
return this;
}
#endregion
}
#endregion
@ -3062,6 +3069,11 @@ namespace SqlSugar
#endregion
#region Other
public new ISugarQueryable<T, T2,T3> Take(int num)
{
QueryBuilder.Take = num;
return this;
}
public new ISugarQueryable<T, T2, T3> Clone()
{
var queryable = this.Context.Queryable<T, T2, T3>((t, t2, t3) => new object[] { }).WithCacheIF(IsCache, CacheTime);
@ -3491,6 +3503,11 @@ namespace SqlSugar
#region Other
public new ISugarQueryable<T, T2,T3,T4> Take(int num)
{
QueryBuilder.Take = num;
return this;
}
public new ISugarQueryable<T, T2, T3, T4> Clone()
{
var queryable = this.Context.Queryable<T, T2, T3, T4>((t, t2, t3, t4) => new object[] { }).WithCacheIF(IsCache, CacheTime);
@ -3882,6 +3899,11 @@ namespace SqlSugar
#endregion
#region Other
public new ISugarQueryable<T, T2, T3, T4,T5> Take(int num)
{
QueryBuilder.Take = num;
return this;
}
public new ISugarQueryable<T, T2, T3, T4, T5> Clone()
{
var queryable = this.Context.Queryable<T, T2, T3, T4, T5>((t, t2, t3, t4, t5) => new object[] { }).WithCacheIF(IsCache, CacheTime);
@ -4309,6 +4331,11 @@ namespace SqlSugar
#endregion
#region Other
public new ISugarQueryable<T, T2, T3, T4, T5,T6> Take(int num)
{
QueryBuilder.Take = num;
return this;
}
public new ISugarQueryable<T, T2, T3, T4, T5, T6> Clone()
{
var queryable = this.Context.Queryable<T, T2, T3, T4, T5, T6>((t, t2, t3, t4, t5, T6) => new object[] { }).WithCacheIF(IsCache, CacheTime);
@ -4727,6 +4754,11 @@ namespace SqlSugar
#endregion
#region Other
public new ISugarQueryable<T, T2, T3, T4, T5, T6,T7> Take(int num)
{
QueryBuilder.Take = num;
return this;
}
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7> Clone()
{
var queryable = this.Context.Queryable<T, T2, T3, T4, T5, T6, T7>((t, t2, t3, t4, t5, T6, t7) => new object[] { }).WithCacheIF(IsCache, CacheTime);
@ -5178,6 +5210,11 @@ namespace SqlSugar
#endregion
#region Other
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7,T8> Take(int num)
{
QueryBuilder.Take = num;
return this;
}
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> Clone()
{
var queryable = this.Context.Queryable<T, T2, T3, T4, T5, T6, T7, T8>((t, t2, t3, t4, t5, T6, t7, t8) => new object[] { }).WithCacheIF(IsCache, CacheTime);
@ -5578,6 +5615,11 @@ namespace SqlSugar
#endregion
#region Other
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8,T9> Take(int num)
{
QueryBuilder.Take = num;
return this;
}
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Clone()
{
var queryable = this.Context.Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9>((t, t2, t3, t4, t5, T6, t7, t8, t9) => new object[] { }).WithCacheIF(IsCache, CacheTime);
@ -5989,6 +6031,11 @@ namespace SqlSugar
#endregion
#region Other
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9,T10> Take(int num)
{
QueryBuilder.Take = num;
return this;
}
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Clone()
{
var queryable = this.Context.Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>((t, t2, t3, t4, t5, T6, t7, t8, t9, t10) => new object[] { }).WithCacheIF(IsCache, CacheTime);
@ -6424,6 +6471,11 @@ namespace SqlSugar
#endregion
#region Other
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10,T11> Take(int num)
{
QueryBuilder.Take = num;
return this;
}
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Clone()
{
var queryable = this.Context.Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>((t, t2, t3, t4, t5, T6, t7, t8, t9, t10, t11) => new object[] { }).WithCacheIF(IsCache, CacheTime);
@ -6885,6 +6937,11 @@ namespace SqlSugar
#endregion
#region Other
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,T12> Take(int num)
{
QueryBuilder.Take = num;
return this;
}
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Clone()
{
var queryable = this.Context.Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>((t, t2, t3, t4, t5, T6, t7, t8, t9, t10, t11, t12) => new object[] { }).WithCacheIF(IsCache, CacheTime);

1
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs

@ -446,6 +446,7 @@ namespace SqlSugar
var mappingKeys = GetMappingColumns(parameter.CurrentExpression);
var isSameType = mappingKeys.Keys.Count>0;
CallContextThread<Dictionary<string,string>>.SetData("Exp_Select_Mapping_Key", mappingKeys);
CallContextAsync<Dictionary<string, string>>.SetData("Exp_Select_Mapping_Key", mappingKeys);
this.Expression = item;
this.Start();
var shortName = parameter.CommonTempData;

9
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs

@ -899,6 +899,10 @@ namespace SqlSugar
formatString = formatString.Replace("M", begin + UtilMethods.ConvertStringToNumbers(this.GetMethodValue("DateValue", parameters).ObjToString()) + end);
parameters.Args.Last().MemberValue = DateType.Day;
if (IsSqlServer())
{
formatString = formatString.Replace("dd",begin+ UtilMethods.ConvertStringToNumbers( string.Format("CASE WHEN LEN({0})=1 THEN '0'+ {0} else {0} end", this.GetMethodValue("DateValue", parameters))) + end);
}
formatString = formatString.Replace("dd", begin + UtilMethods.ConvertStringToNumbers(this.GetMethodValue("DateValue", parameters).ObjToString()) + end);
formatString = formatString.Replace("d", begin + UtilMethods.ConvertStringToNumbers(this.GetMethodValue("DateValue", parameters).ObjToString()) + end);
@ -951,7 +955,10 @@ namespace SqlSugar
}
return this.GetMethodValue("MergeString", joinStringParameter).ObjToString();
}
private bool IsSqlServer()
{
return this.Context is SqlServerExpressionContext;
}
private bool IsMySql()
{
return this.Context is MySqlExpressionContext;

4
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Infrastructure/ContextMethods.cs

@ -272,6 +272,10 @@ namespace SqlSugar
{
var readerValues = DataReaderToDictionary(reader, tType);
var mappingKeys = CallContextThread<Dictionary<string, string>>.GetData("Exp_Select_Mapping_Key");
if (mappingKeys == null)
{
mappingKeys = CallContextAsync<Dictionary<string, string>>.GetData("Exp_Select_Mapping_Key");
}
var result = new Dictionary<string, object>();
foreach (var item in classProperties)
{

1
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Interface/IDeleteable.cs

@ -35,6 +35,7 @@ namespace SqlSugar
IDeleteable<T> RemoveDataCache();
IDeleteable<T> RemoveDataCache(string likeString);
KeyValuePair<string, List<SugarParameter>> ToSql();
IDeleteable<T> EnableQueryFilter();
void AddQueue();
}
}

11
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Interface/IQueryable.cs

@ -246,6 +246,7 @@ namespace SqlSugar
#endregion
#region Other
new ISugarQueryable<T,T2> Take(int num);
new ISugarQueryable<T, T2> Clone();
new ISugarQueryable<T, T2> AS<AsT>(string tableName);
new ISugarQueryable<T, T2> AS(string tableName);
@ -341,6 +342,7 @@ namespace SqlSugar
#endregion
#region Other
new ISugarQueryable<T, T2,T3> Take(int num);
new ISugarQueryable<T, T2, T3> Clone();
new ISugarQueryable<T, T2, T3> AS<AsT>(string tableName);
new ISugarQueryable<T, T2, T3> AS(string tableName);
@ -443,6 +445,7 @@ namespace SqlSugar
#endregion
#region Other
new ISugarQueryable<T, T2,T3,T4> Take(int num);
new ISugarQueryable<T, T2, T3, T4> Clone();
new ISugarQueryable<T, T2, T3, T4> AS<AsT>(string tableName);
new ISugarQueryable<T, T2, T3, T4> AS(string tableName);
@ -541,6 +544,7 @@ namespace SqlSugar
#endregion
#region Other
new ISugarQueryable<T, T2, T3, T4, T5> Take(int num);
new ISugarQueryable<T, T2, T3, T4, T5> Clone();
new ISugarQueryable<T, T2, T3, T4, T5> AS<AsT>(string tableName);
new ISugarQueryable<T, T2, T3, T4, T5> AS(string tableName);
@ -646,6 +650,7 @@ namespace SqlSugar
#endregion
#region Other
new ISugarQueryable<T, T2, T3, T4, T5, T6> Take(int num);
new ISugarQueryable<T, T2, T3, T4, T5, T6> Clone();
new ISugarQueryable<T, T2, T3, T4, T5, T6> AS<AsT>(string tableName);
new ISugarQueryable<T, T2, T3, T4, T5, T6> AS(string tableName);
@ -750,6 +755,7 @@ namespace SqlSugar
#endregion
#region Other
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7> Take(int num);
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7> Clone();
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7> AS<AsT>(string tableName);
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7> AS(string tableName);
@ -860,6 +866,7 @@ namespace SqlSugar
#endregion
#region Other
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7,T8> Take(int num);
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> Clone();
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> AS<AsT>(string tableName);
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> AS(string tableName);
@ -954,6 +961,7 @@ namespace SqlSugar
#endregion
#region Other
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Take(int num);
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Clone();
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> AS<AsT>(string tableName);
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> AS(string tableName);
@ -1049,6 +1057,7 @@ namespace SqlSugar
#endregion
#region Other
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9,T10> Take(int num);
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Clone();
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> AS<AsT>(string tableName);
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> AS(string tableName);
@ -1149,6 +1158,7 @@ namespace SqlSugar
#endregion
#region Other
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9,T10,T11> Take(int num);
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Clone();
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> AS<AsT>(string tableName);
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> AS(string tableName);
@ -1254,6 +1264,7 @@ namespace SqlSugar
#endregion
#region Other
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Take(int num);
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Clone();
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> AS<AsT>(string tableName);
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> AS(string tableName);

2
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/SqlSugar.csproj

@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>5.0.4.1-perview-01</Version>
<Version>5.0.4.1-perview-02</Version>
<Copyright>sun_kai_xuan</Copyright>
<PackageProjectUrl>https://github.com/sunkaixuan/SqlSugar</PackageProjectUrl>
<PackageLicenseUrl></PackageLicenseUrl>

2
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/SqlSugarForCore.nuspec

@ -2,7 +2,7 @@
<package >
<metadata>
<id>SqlSugarCore</id>
<version>5.0.4.1-perview-01</version>
<version>5.0.4.1-perview-02</version>
<authors>sunkaixuan</authors>
<owners>Landa</owners>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>

2
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/SqlSugarForCoreMySqlConnector.nuspec

@ -2,7 +2,7 @@
<package >
<metadata>
<id>SqlSugarCore.MySqlConnector</id>
<version>5.0.4.1-perview-01</version>
<version>5.0.4.1-perview-02</version>
<authors>sunkaixuan</authors>
<owners>Landa</owners>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>

2
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/SqlSugarForCoreNoDrive.nuspec

@ -2,7 +2,7 @@
<package >
<metadata>
<id>SqlSugarCoreNoDrive</id>
<version>5.0.4.1-perview-01</version>
<version>5.0.4.1-perview-02</version>
<authors>sunkaixuan</authors>
<owners>Landa</owners>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>

Loading…
Cancel
Save