Synchronization code

This commit is contained in:
sunkaixuan
2023-09-29 12:24:15 +08:00
parent 2eec703eab
commit f37725fa56
4 changed files with 10 additions and 0 deletions

View File

@@ -65,6 +65,7 @@ namespace SqlSugar
{ {
ignoreColumns = new string[] { }; ignoreColumns = new string[] { };
} }
this.Context = UpdateNavProvider._Context;
var navColumns = this.Context.EntityMaintenance.GetEntityInfo<Root>().Columns.Where(it=> !ignoreColumns.Contains(it.PropertyName) || !ignoreColumns.Any(z=>z.EqualCase(it.DbColumnName))).Where(it => it.Navigat != null).ToList(); var navColumns = this.Context.EntityMaintenance.GetEntityInfo<Root>().Columns.Where(it=> !ignoreColumns.Contains(it.PropertyName) || !ignoreColumns.Any(z=>z.EqualCase(it.DbColumnName))).Where(it => it.Navigat != null).ToList();
var updateNavs = this; var updateNavs = this;
UpdateNavMethodInfo methodInfo = updateNavs.IncludeByNameString(navColumns[0].PropertyName); UpdateNavMethodInfo methodInfo = updateNavs.IncludeByNameString(navColumns[0].PropertyName);

View File

@@ -753,6 +753,13 @@ namespace SqlSugar
model.Args[0].MemberName = name; model.Args[0].MemberName = name;
return AggregateSum(model); return AggregateSum(model);
} }
public virtual string AggregateAvgNoNull(MethodCallExpressionModel model)
{
model.Args.Add(new MethodCallExpressionArgs() { MemberValue = 0, MemberName = 0 });
var name = IsNull(model);
model.Args[0].MemberName = name;
return AggregateAvg(model);
}
public virtual string JsonListObjectAny(MethodCallExpressionModel model) public virtual string JsonListObjectAny(MethodCallExpressionModel model)
{ {
throw new NotImplementedException("Current database no support"); throw new NotImplementedException("Current database no support");

View File

@@ -105,6 +105,7 @@ namespace SqlSugar
string JsonLike(MethodCallExpressionModel model); string JsonLike(MethodCallExpressionModel model);
string Collate(MethodCallExpressionModel model); string Collate(MethodCallExpressionModel model);
string AggregateSumNoNull(MethodCallExpressionModel model); string AggregateSumNoNull(MethodCallExpressionModel model);
string AggregateAvgNoNull(MethodCallExpressionModel model);
string JsonListObjectAny(MethodCallExpressionModel model); string JsonListObjectAny(MethodCallExpressionModel model);
string JsonArrayAny(MethodCallExpressionModel model); string JsonArrayAny(MethodCallExpressionModel model);
string CompareTo(MethodCallExpressionModel model); string CompareTo(MethodCallExpressionModel model);

View File

@@ -318,6 +318,7 @@ namespace SqlSugar
public static TResult AggregateSumNoNull<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); } public static TResult AggregateSumNoNull<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
public static string Collate(string thisValue) { throw new NotSupportedException("Can only be used in expressions"); } public static string Collate(string thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
public static TResult AggregateAvg<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); } public static TResult AggregateAvg<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
public static TResult AggregateAvgNoNull<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
public static TResult AggregateMin<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); } public static TResult AggregateMin<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
public static TResult AggregateMax<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); } public static TResult AggregateMax<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
public static int AggregateCount<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); } public static int AggregateCount<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }