mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-20 04:48:16 +08:00
- Lambda 参数化功能的 bug 解决
This commit is contained in:
@ -504,6 +504,7 @@ namespace FreeSql.Internal
|
||||
public string ExpressionLambdaToSql(Expression exp, ExpTSC tsc)
|
||||
{
|
||||
if (exp == null) return "";
|
||||
if (tsc.dbParams != null && tsc.mapColumnTmp != null && tsc.mapColumnTmp.CsType.NullableTypeOrThis() != exp.Type) tsc.SetMapColumnTmp(null);
|
||||
if (tsc.isDisableDiyParse == false && _common._orm.Aop.ParseExpression != null)
|
||||
{
|
||||
var args = new Aop.ParseExpressionEventArgs(exp, ukexp => ExpressionLambdaToSql(ukexp, tsc.CloneDisableDiyParse()));
|
||||
|
@ -890,6 +890,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
if (_tables[0].Table.Primarys.Any() == false) throw new Exception($"ToDelete 功能要求实体类 {_tables[0].Table.CsName} 必须有主键");
|
||||
var del = _orm.Delete<T1>();
|
||||
if (_tables[0].Table.Type != typeof(T1)) del.AsType(_tables[0].Table.Type);
|
||||
if (_params.Any()) del.GetType().GetField("_params", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(del, new List<DbParameter>(_params.ToArray()));
|
||||
return del.Where(GetToDeleteWhere("ftb_del"));
|
||||
}
|
||||
public IUpdate<T1> ToUpdate()
|
||||
@ -897,6 +898,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
if (_tables[0].Table.Primarys.Any() == false) throw new Exception($"ToUpdate 功能要求实体类 {_tables[0].Table.CsName} 必须有主键");
|
||||
var upd = _orm.Update<T1>();
|
||||
if (_tables[0].Table.Type != typeof(T1)) upd.AsType(_tables[0].Table.Type);
|
||||
if (_params.Any()) upd.GetType().GetField("_params", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(upd, new List<DbParameter>(_params.ToArray()));
|
||||
return upd.Where(GetToDeleteWhere("ftb_upd"));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user