Entity Framework - Best practices

Comments

Gravatar Image
Benjamin Andersen 11/22/2018 9:04:00 AM
Nice post and I totally agree that Lazy Loading should be disabled. When including I would suggest using System.Data.Entity, then you don´t have the string include expression will change from: .Include(“Months”) to .Include(x => x.Months).
Gravatar Image
Mathieu 6/18/2016 8:54:00 PM
if you are talking about best practises, turn off lazy loading Configuration.LazyLoadingEnabled = false; Configuration.ProxyCreationEnabled= false; https://alexandrebrisebois.wordpress.com/2013/08/29/friends-dont-let-friends-use-lazy-loading-on-windows-azure/ also these tips are for L2S, but they also apply for EF http://www.sidarok.com/web/blog/content/2008/05/02/10-tips-to-improve-your-linq-to-sql-application-performance.html and here is another link for EF bulk inserts https://weblog.west-wind.com/posts/2013/Dec/22/Entity-Framework-and-slow-bulk-INSERTs Hope it helps 🙂
Gravatar Image
Jeffrey Rosselle 6/20/2016 7:50:00 AM
Of course the Lazy Loading option should be turned off, how could I forget to add it :). Lucky it is turned off in our application though. I’ll have a look at the other blogs and see if I can add some points into my post. Thanks again!