简体   繁体   English

实体框架中的自动查询结果

[英]Automatic Query result in Entity-Framework

I have a database with lots of tables connected with a foreign keys. 我有一个数据库,其中有许多用外键连接的表。 I use Entity Framework 6 with .NET 4.5 in Visual Studio. 我在Visual Studio中将Entity Framework 6与.NET 4.5一起使用。

I wanted to know if Entity Framework has an option to automatically return results by querying the main table for its ID and return all the results in JSON from all the connected tables including the main table. 我想知道Entity Framework是否可以通过查询主表的ID来自动返回结果,并从包括主表在内的所有已连接表返回JSON中的所有结果。 Is such option exists, considering that I need to query only based on the main table ID. 是否存在这样的选项,考虑到我只需要基于主表ID进行查询。

You are talking about Lazy Loading. 您正在谈论延迟加载。 I believe it is enable by default and you can check this example. 我相信默认情况下它是启用的,您可以查看此示例。

http://msdn.microsoft.com/en-us/data/jj574232.aspx http://msdn.microsoft.com/en-us/data/jj574232.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM