Browse Source

Update .net core project

SqlSugar5
sunkaixuan 2 years ago
parent
commit
675a10cdeb
  1. 17
      Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ResolveItems/OneToManyNavgateExpression.cs
  2. 4
      Src/Asp.NetCore2/SqlSugar/Utilities/CommonExtensions.cs

17
Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ResolveItems/OneToManyNavgateExpression.cs

@ -57,12 +57,27 @@ namespace SqlSugar
private string GetWhereSql(MethodCallExpression memberExp)
{
var whereExp = memberExp.Arguments[1];
if (PropertyShortName.HasValue()&& Navigat!=null&& Navigat.NavigatType==NavigateType.OneToMany)
if (PropertyShortName.HasValue() && Navigat != null && Navigat.NavigatType == NavigateType.OneToMany)
{
InitType(whereExp);
var result = this.methodCallExpressionResolve.GetNewExpressionValue(whereExp, ResolveExpressType.WhereMultiple);
return result;
}
else if (whereExp!=null&&whereExp.Type == typeof(List<IConditionalModel>))
{
var value = ExpressionTool.GetExpressionValue(whereExp) as List<IConditionalModel>;
//this.context.Utilities.Context.Queryable<object>().Where(value).ToList();
if (value.HasValue())
{
var sqlObj = this.context.Queryable<object>().SqlBuilder.ConditionalModelToSql(value, 0);
methodCallExpressionResolve.Context.Parameters.AddRange(sqlObj.Value);
return sqlObj.Key;
}
else
{
return " 1=1 ";
}
}
else
{
InitType(whereExp);

4
Src/Asp.NetCore2/SqlSugar/Utilities/CommonExtensions.cs

@ -28,5 +28,9 @@ namespace SqlSugar
{
return new List<T>() { thisValue };
}
public static bool Any<T>(this IEnumerable<T> thisValue, IEnumerable<IConditionalModel> conditionalModels)
{
throw new Exception("Can only be used in expressions");
}
}
}

Loading…
Cancel
Save