mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 12:03:21 +08:00
- 优化 WhereDynamic 传入 DynamicFilterInfo 也能执行;
This commit is contained in:
parent
d617b237de
commit
35069609de
@ -338,9 +338,26 @@ namespace FreeSql.Internal.CommonProvider
|
||||
_tables[0].Parameter = exp.Parameters[0];
|
||||
return this.InternalWhere(exp?.Body);
|
||||
}
|
||||
public ISelect<T1> WhereDynamic(object dywhere, bool not = false) => not == false ?
|
||||
this.Where(_commonUtils.WhereObject(_tables.First().Table, $"{_tables.First().Alias}.", dywhere)) :
|
||||
this.Where($"not({_commonUtils.WhereObject(_tables.First().Table, $"{_tables.First().Alias}.", dywhere)})");
|
||||
public ISelect<T1> WhereDynamic(object dywhere, bool not = false)
|
||||
{
|
||||
if (dywhere is DynamicFilterInfo dyfilter)
|
||||
{
|
||||
if (not == false) return this.WhereDynamicFilter(dyfilter);
|
||||
|
||||
var oldwhere = _where.ToString();
|
||||
_where.Clear();
|
||||
|
||||
this.WhereDynamicFilter(dyfilter);
|
||||
var newwhere = _where.ToString();
|
||||
_where.Clear();
|
||||
|
||||
return this
|
||||
.Where(oldwhere)
|
||||
.WhereIf(string.IsNullOrWhiteSpace(newwhere) == false, $"not({newwhere})");
|
||||
}
|
||||
var wheresql = _commonUtils.WhereObject(_tables.First().Table, $"{_tables.First().Alias}.", dywhere);
|
||||
return not == false ? this.Where(wheresql) : this.Where($"not({wheresql})");
|
||||
}
|
||||
|
||||
public ISelect<T1> WhereCascade(Expression<Func<T1, bool>> exp)
|
||||
{
|
||||
|
@ -189,7 +189,7 @@ QQ群:4336577(已满)、8578575(在线)、52508226(在线)
|
||||
## 💕 Donation
|
||||
|
||||
L*y 58元、花花 88元、麦兜很乖 50元、网络来者 2000元、John 99.99元、alex 666元、bacongao 36元、无名 100元、Eternity 188元、无名 10元、⌒.Helper~..oO 66元、习惯与被习惯 100元、无名 100元、蔡易喋 88.88元、中讯科技 1000元、Good Good Work 24元、炽焰 6.6元、Nothing 100元、兰州天擎赵 500元、哈利路亚 300元、
|
||||
无名 100元、蛰伏 99.99元、TCYM 66.66元、MOTA 5元、LDZXG 30元、Near 30元、建爽 66元、无名 200元、LambertWu 100元
|
||||
无名 100元、蛰伏 99.99元、TCYM 66.66元、MOTA 5元、LDZXG 30元、Near 30元、建爽 66元、无名 200元、LambertWu 100元、无名 18.88元、乌龙 50元
|
||||
|
||||
> Thank you for your donation
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user