本文介绍了实体框架应该只返回父表而不是子表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想只返回父表数据,但默认情况下,db context返回带有子表数据的父表的数据。可以创建另一个模型并设置父表数据,但查找只返回父表数据的实体。
让我知道直接代码我怎么才能得到父表数据。
预付款,
问候,
Arun RV
我的尝试:
Hi All,
I want to return only the parent table data but by default db context return data with parent table with child table data. Can create another model and set the parent table data but looking for entity returning only parent table data.
Let me know the direct code how can I get only the parent table data.
Advance thanks,
Regards,
Arun RV
What I have tried:
_dbContext.TestResults.ToArray();
推荐答案
这篇关于实体框架应该只返回父表而不是子表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!