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.
精彩评论