Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.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# 实体框架linq查询_C#_Asp.net Mvc_Linq_Entity Framework - Fatal编程技术网

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)