Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.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
如何做一个;加入;在针对实体框架的LINQ查询中_Linq_Entity Framework_Linq To Entities_Linq To Objects - Fatal编程技术网

如何做一个;加入;在针对实体框架的LINQ查询中

如何做一个;加入;在针对实体框架的LINQ查询中,linq,entity-framework,linq-to-entities,linq-to-objects,Linq,Entity Framework,Linq To Entities,Linq To Objects,我有下面的表结构,它已经导入到实体框架中。我需要编写一个LINQ查询,在这里我选择表1的实体,表2中的一个字段等于true,表3中的一个字段等于一个特定的GUID 有人能帮忙吗 谢谢你 试试: from t3 in dataContext.Table3 where t3.Guidfield == someGuid from t2 in t3.Table2 where t2.Field // boolean field is true select t2.Table1; 编辑:根

我有下面的表结构,它已经导入到实体框架中。我需要编写一个LINQ查询,在这里我选择表1的实体,表2中的一个字段等于true,表3中的一个字段等于一个特定的GUID

有人能帮忙吗

谢谢你

试试:

from t3 in dataContext.Table3
  where t3.Guidfield == someGuid
  from t2 in t3.Table2
  where t2.Field // boolean field is true
  select t2.Table1;
编辑:根据请求,等效lambda表达式语法:

dataContext.Table3.Where(t3 => t3.Guidfield == someGuid)
              .SelectMany(t3 => t3.Table2)
              .Where(t2 => t2.Field)
              .Select(t2.Table1);

这将如何转化为点符号?编辑后的文章提供了lambda表达式语法示例。
from t1 in table1
join t2 in table2
on t1.table1PK equals t2.table1PK
join t4 in table4
on t2.table2PK equals t4.table2PK
join t3 in table3
on t3.table3PK equals t4.table3PK
where  t2.randomBoolColumn == true && t3.GUID == myGUIDVariable
select t1;