然后包括在.NET核心中不起作用的条件 [英] Theninclude with condition not working in .NET core

查看:112
本文介绍了然后包括在.NET核心中不起作用的条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

var cert = _context.Certificates
             .Include(c => c.Staff)
             .ThenInclude(c => c.Department.Abbr.Contains("cs"))
             .Where(c => (int)c.CertificateType == 1)
             .AsNoTracking();



ThenInclude给出错误,因为表达式应代表.net核心中的访问属性。



什么我试过了:



上面的代码没有给出语法错误。但是在运行它时不起作用。


ThenInclude gives error as the expression should represent a property for access in .net core.

What I have tried:

The above code does not give syntax error. But while running it does not work.

推荐答案

如果你不知道的话,你应该把Google错误消息给你...

它你似乎只是在这里遇到一个已知问题:

支持过滤包含·问题#1833·aspnet / EntityFrameworkCore ·GitHub [ ^ ]
You should Google you error message whenever it is not know for you...
It seems you just hit a known issue here:
Support filtered Include · Issue #1833 · aspnet/EntityFrameworkCore · GitHub[^]


这篇关于然后包括在.NET核心中不起作用的条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆