A Smarter Entity Framework Include Method
One of the things I have always disliked about Entity Framework and their support for LINQ is that while your whole LINQ statement is compile time checked to make sure you didn’t fat finger any SQL statement, the Include() statement is not. How many times has something like this happened to you? var account1001 = (new AccountEntities()) .Accounts.Include("Userx") .Where(account => account.Id == 1001) .SingleOrDefault(); You might have noticed in the above that I probably wanted “Users” instead of “Userx”. I don’t know about you but this happens to me all the time, and if the code was just compile time checks like the rest of the LINQ statement everything would be great and I would instantly catch the bug when the code was compiled. ...