Skip to content

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

@yaobo-lab

Description

@yaobo-lab

问题描述及重现步骤:

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions