[英]Entity framework linq query
I have this piece of code. 我有这段代码。 What i need to do is to exclude
mc_host_class
values that are inside the list. 我需要做的是排除列表中的
mc_host_class
值。
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);
Thank you for helping 感谢您的帮助
If I understood your question, I think this could help you: 如果我了解您的问题,我认为这可以为您提供帮助:
(!(
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))
List1.Contains(value1) return a bool if a value1 is in List1, but you used it like value1.Contains(List1). 如果value1在List1中,则List1.Contains(value1)返回布尔值,但是您像value1.Contains(List1)一样使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.