This is my first attempt at understanding Linq to Entity coming from Net Tiers. Struggling with it but not understanding some of the logic behind it… for instance.
When do I use:
Entity.EntitySet.Load()
and
context.Entity.Include("EntitySet").SingleOrDefault()
Also why does Include take a string and not an enum or sorts?
In EF you have the concepts of Lazy loading and Eager loading.
Al tough Include takes a string this doesn’t mean you can’t extend this!
T4 is a nice thing. In a project I’ve worked on we created an EntityProperty class that contained static properties for all the Navigational properties on an entity. This way you would at least get a compile error if a property name changes.
If you really want to go one step further you could build a Include method that takes a Lambda and then rearrange the Expression tree before executing it to the QueryProvider. Then you would have nice static typing.