If you want to Eager Load a relation in entity framework, you can use the Include() method in LINQ to Entities, but the include is useful even With EntitySQl and object services, but the syntax is something that violates the principle of least surprise for me.
I started with:
It seems pretty reasonable to me, but this does not work, no eager fetch of any courses….after some minutes of perplexity I realized that the Include Method does return a query object……so the right way to eager fetch the Course collection is
This sound bad to me, I didn’t really expect that the Include actually creates a complete different query object. It turns out that the best way to do this is chain the Include in the original call.