如何按实体框架获得表的所有关系列表?
我如何使用.include()
为了包括所有在实体框架中表(类)关系的所有关系列表?
我看到了此选项:
var coursesWithStudents = context.courses.Include("students").ToList();
但是我需要一些通用的东西,而不仅仅是特定表格,并包括表的所有关系。
有什么办法吗?
谢谢大家。
How can I use .Include()
in order to include all lists of relationships of a table (class) in Entity Framework?
I saw this option:
var coursesWithStudents = context.courses.Include("students").ToList();
But I need something generic, not just for a specific table, and to include all of the relationships of the table.
Is there any way to do that?
Thanks all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想以通用形式获得相关实体。我认为您可以看到高分解决方案,这将为您提供帮助。
ef,包括其他实体(通用存储库模式)
If you want to get related entities in generic form. I think you could see high score solution of question and it will help you.
EF Including Other Entities (Generic Repository pattern)