开发者

EF return parent entity only

I'm having an issue when trying to serialise an entity. An error is being through saying that the query may result in a circular query. Ideally I just want to pull out the entity with no relationships attached. I've seen some examples开发者_JAVA技巧 where you can set the relation accessor to Internal but this causes other issues. Is there a way to do this in straight LINQ?

Thanks for the help.


Try returning a single entity using FirstOrDefault()

The reason that you are getting the circular error is probably due to your data model where a row points to the parent which could be the same row.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜