Entity Framework - Using Navigation Properties Over Connections

I am working with Entity Framework on an old database without any links. Our queries are now written as Linq Joins.

Are there advantages (and maybe disadvantages) for adding associations to the model and writing our queries using navigation properties? I am not lucky enough to find a direct answer to this question yet and you want to know if it is worth the effort.

I believe there is no efficiency gain if the query generated by the navigation properties is similar to the Join query.

I have listed all the pros and cons of Navigation Properties compared to Joins :

Pro

  • The queries are much shorter and more readable since the key mappings are hidden.
  • Object relationships are automatically provided
  • Results are hierarchical and not flattened

Kon

+3


source to share


1 answer


Actually, you answered your own question. Of course, queries using navigation properties are much more convenient than queries using join

s.



Relatively Include

- overextends from Include

basically analog overextends from join

, because Include

at least, join

and maybe something else. Don't record requests with dozens of calls Include

and there will be no performance.

+1


source







All Articles