c# - Entity Framework - Using Navigation Properties over Joins -
i'm working entity framework on legacy database no relationships. our queries written linq joins.
are there advantages (and maybe disadvantages) adding associations in model , writing our queries navigation properties? had no luck far finding straightforward answer question , want know if it's worth effort.
i believe there no benefit performance wise if query generated navigation properties similar join query.
i listed believe pros , cons of navigation properties compared joins:
pro
- queries lot shorter , more readable because mappings of keys hidden
- object relationships automatically provided
- results hierarchical , not flattened
con
- creating query include-statements can take longer (see 8.2.2 in interesting link performance considerations entity framework 4, 5, , 6)
actually, you've answered question. of course, queries using navigation properties more convenient, queries join
s.
concerning include
s - overusing of include
analogue of overusing of join
, because include
@ least join
and, optionally, else. not write queries tens of include
calls, , there won't performance hit.
Comments
Post a Comment