A better Include method for eager loading in Entity Framework?

Matthieu has written a very clever method extension that allows the important eager loading method, Include, to accept a lambda expression (strongly typed) rather than a string for its parameter.

I like this better than my method of ensuring that I type the strings correctly, which is to start entering the parameter without the quotes and let intellisense help me, then add the quotes after the fact.

Here is the actual documentation that covers Include (look under “Query Path” in this topic) if you’re not sure what we’re talking about.

  Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!  

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.