- 修复 DbContext/Repository Update 不更新 DbUpdateValue 的问题;#219

This commit is contained in:
28810
2020-02-28 10:41:03 +08:00
parent 761b6e0068
commit f22f65fee9
17 changed files with 321 additions and 18 deletions

View File

@ -553,20 +553,31 @@ namespace FreeSql.Extensions.EntityUtil
{
if (_table.ColumnsByCs.TryGetValue(prop.Name, out var trycol) == false) continue;
exps.Add(
Expression.IfThenElse(
Expression.Equal(
Expression.MakeMemberAccess(var1Parm, prop),
Expression.MakeMemberAccess(var2Parm, prop)
),
trycol.Attribute.CanUpdate == false ?
Expression.IfThen(
Expression.IsTrue(parm3),
Expression.Call(var1Ret, typeof(List<string>).GetMethod("Add", new Type[] { typeof(string) }), Expression.Constant(trycol.Attribute.Name))
),
Expression.IfThen(
Expression.IsFalse(parm3),
Expression.Call(var1Ret, typeof(List<string>).GetMethod("Add", new Type[] { typeof(string) }), Expression.Constant(trycol.Attribute.Name))
) : (
trycol.Attribute.CanUpdate && string.IsNullOrEmpty(trycol.DbUpdateValue) == false ?
Expression.IfThen(
Expression.IsFalse(parm3),
Expression.Call(var1Ret, typeof(List<string>).GetMethod("Add", new Type[] { typeof(string) }), Expression.Constant(trycol.Attribute.Name))
) :
Expression.IfThenElse(
Expression.Equal(
Expression.MakeMemberAccess(var1Parm, prop),
Expression.MakeMemberAccess(var2Parm, prop)
),
Expression.IfThen(
Expression.IsTrue(parm3),
Expression.Call(var1Ret, typeof(List<string>).GetMethod("Add", new Type[] { typeof(string) }), Expression.Constant(trycol.Attribute.Name))
),
Expression.IfThen(
Expression.IsFalse(parm3),
Expression.Call(var1Ret, typeof(List<string>).GetMethod("Add", new Type[] { typeof(string) }), Expression.Constant(trycol.Attribute.Name))
)
)
)
)
);
a++;
}