Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用EntityFrameworkPlus IncludeFilter在Include上过滤_C#_.net_Linq_.net Core_Entity Framework Plus - Fatal编程技术网

C# 使用EntityFrameworkPlus IncludeFilter在Include上过滤

C# 使用EntityFrameworkPlus IncludeFilter在Include上过滤,c#,.net,linq,.net-core,entity-framework-plus,C#,.net,Linq,.net Core,Entity Framework Plus,我尝试向下筛选三个子级别,并查找propertyMailGadAddress.Status==True的唯一子元素 如何将过滤器向下转换三个级别,并使用EntityFrameworkPlus IncludeFilter执行嵌套过滤?最有效的方法是什么 类结构嵌套如下: var result = await db.Property.IncludeFilter(pm => pm.PropertyParty .Select(x =&

我尝试向下筛选三个子级别,并查找propertyMailGadAddress.Status==True的唯一子元素

如何将过滤器向下转换三个级别,并使用EntityFrameworkPlus IncludeFilter执行嵌套过滤?最有效的方法是什么

类结构嵌套如下:

var result = await db.Property.IncludeFilter(pm => pm.PropertyParty
                                .Select(x => x.Party)
                                .SelectMany(x => x.PartyMailingAddress)
                                .SelectMany(x => x.PropertyMailingAddress.Where(z => z.Status == true)).ToListAsync();
  • 财产
  • 财产当事人
  • 聚会
  • 派对服装

  • 属性mailingAddress您不能将
    包含
    包含过滤器混用

    在EF Core中,
    IncludeFilter
    应自动添加所有路径

    我们没有类定义,因此很难准确了解关系,但查询应如下所示:

    var result = await db.Property.IncludeFilter(pm => pm.PropertyParty
                                    .Select(x => x.Party)
                                    .SelectMany(x => x.PartyMailingAddress)
                                    .SelectMany(x => x.PropertyMailingAddress.Where(z => z.Status == true)).ToListAsync();
    
    过滤在数据库中完成。所以要小心使用EF Core 2.x,因为他们在EF Core 3.x中删除了客户端评估,这导致了一些问题


    如果您需要更多帮助,请在我们的问题跟踪器中提供一个可运行的解决方案:

    您可以附加您的类定义吗?嗨,Jon,我需要相关的实体,答案中有过滤器,您的答案只包含过滤器,谢谢
    var result = await db.Property.IncludeFilter(pm => pm.PropertyParty
                                    .Select(x => x.Party)
                                    .SelectMany(x => x.PartyMailingAddress)
                                    .SelectMany(x => x.PropertyMailingAddress.Where(z => z.Status == true)).ToListAsync();