Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于DataFilter.Disable 没有起作用 #846

Closed
yaobo-lab opened this issue Aug 7, 2021 · 2 comments
Closed

关于DataFilter.Disable 没有起作用 #846

yaobo-lab opened this issue Aug 7, 2021 · 2 comments
Labels
question Further information is requested

Comments

@yaobo-lab
Copy link

yaobo-lab commented Aug 7, 2021

问题描述及重现步骤:

程序启动时启用了全局软删除过滤器

freesql.GlobalFilter.Apply<IEntitySoftDelete>("SoftDelete", a => a.IsDel == 0);

搜索过滤测试

var item1 = _fsql.GetGuidRepository<BillItem>().Where(m => m.BillNo.Equals(BillNo)).ToList();
var rep = _fsql.GetGuidRepository<BillItem>();        
using (rep.DataFilter.Disable("SoftDelete"))
{
    //在这段中,repo1 之 test 过滤器失效
   var item2= rep.Where(m => m.BillNo.Equals(BillNo)).ToSql();  
}
//
var item3 = rep.Where(m => m.BillNo.Equals(BillNo)).ToList();

其中item1 item2 item3 搜索出来的结果一样均是一条记录,理论过滤器失效,item2 会搜索出两条记录
请问 是我的用法有问题吗?

数据库的具体版本

mysql8.0

安装的包

freesql nuget 包 2.5.2000

.net framework/. net core? 及具体版本

.NET5
@luoyunchong
Copy link
Collaborator

你使用的是全局过滤器,不是仓储过滤器
image
http://freesql.net/guide/filters.html

@luoyunchong luoyunchong added the question Further information is requested label Aug 7, 2021
@yaobo-lab
Copy link
Author

thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants