C# 实体框架linq查询
我有这段代码。我需要做的是排除列表中的C# 实体框架linq查询,c#,asp.net-mvc,linq,entity-framework,C#,Asp.net Mvc,Linq,Entity Framework,我有这段代码。我需要做的是排除列表中的mc\u host\u类值 enter var myList = (from p in db.Full where ( (p.date_reception > begin & p.date_reception < end & !p.mc_host_class.Contains("NULL")) & ( !p.mc_host_class
mc\u host\u类
值
enter var myList = (from p in db.Full
where ( (p.date_reception > begin & p.date_reception < end & !p.mc_host_class.Contains("NULL")) &
( !p.mc_host_class.Contains( (
from p2 in db.exclure
where (p2.type.Contains("Host"))
group p2 by p2.libelle into g
select new { libellex = g.Key}).ToList()
)))
group p by p.mc_host_class into g
orderby g.Count() descending
select new
{
hostclassx = g.Key,
countx = g.Count()
}).ToList().Take(10);
输入var myList=(从p到db.Full)
其中((p.date\u receivement>begin&p.date\u receivement
感谢您的帮助如果我理解您的问题,我想这可以帮助您:
(!(
from p2 in db.exclure
where (p2.type.Contains("Host")
group p2 by p2.libelle into g
select new { libellex = g.Key}
).ToList().Contains(p.mc_host_class))
如果值1在列表1中,但您使用它的方式与value1.Contains(列表1)类似,那么List1.Contains(value1)返回bool
什么东西不起作用?我在这里(!p.mc_host_class.Contains)下面画了下划线((从db.excure中的p2开始,其中(p2.type.Contains(“host”))将p2按p2.libelle分组到g中选择新建{libellex=g.Key}).ToList()在!p.mc#u host#u类和ToList()下,那么它说什么呢?无法将匿名类型#转换为string他们告诉我包含的(匿名类型#1)未验证arguments@drexdrex我添加了一个屏幕快照很抱歉我看不到它,公司使用代理,我设法解决了它,非常感谢您的帮助(y)