Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.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 - Fatal编程技术网

Linq 林克。缺表

Linq 林克。缺表,linq,Linq,我有3个表:带列的表1(ProductId、name等)、表2(DocumentId、name等)、表3(ProductId、DocumentId)。当我创建一个.edmx模型时,我的模型中只有表1和表2,我看不到表3。如果缺少表3,如何获取产品的文档?请注意,创建模型时,产品中有一个名为Documents的属性,文档中有一个名为Products的属性 要查看产品中的文档,请致电: var documents = DbContext.Documents.Include("Products").T

我有3个表:带列的表1(ProductId、name等)、表2(DocumentId、name等)、表3(ProductId、DocumentId)。当我创建一个.edmx模型时,我的模型中只有表1和表2,我看不到表3。如果缺少表3,如何获取产品的文档?

请注意,创建模型时,产品中有一个名为Documents的属性,文档中有一个名为Products的属性

要查看产品中的文档,请致电:

var documents = DbContext.Documents.Include("Products").ToList();
产品也是如此

var products = DbContext.Products.Include("Documents").ToList();
然后,您将产品作为每个文档的集合,文档作为每个产品的集合

这发生在EF中的每个多对多表上。

通过。