tabs ↹ over ␣ ␣ ␣ spaces

by Jiří {x2} Činčura

Implicit lazy loading on by default in EF4

8 Nov 2009 1 mins Entity Framework

The last beta (Beta 2) of Visual Studio 2010 with EF4 contains one “interesting” change. The implicit lazy loading is turned on by default. And I’m not sure I like it.

I can handle the fact, that there was a strong demand for it (as Julie pointed) and that for LINQ to SQL people or beginners this may be much easier. But from a database guy perspective this is hidden evil, especially if you’re not the only one developer in project. You don’t know when you’re hitting the database and maybe worse, everything seems to be working fine (all data are there), but it’s a performance problem when you deploy the application from local/test environment. And how surprising will it be, when the context will be gone.

Maybe I change my opinion after trying to work with it. But now, I’ll rather use eager loading or I’ll be explicit with my calls to database. To be on safe side. What do you think?

Profile Picture Jiří Činčura is .NET, C# and Firebird expert. He focuses on data and business layers, language constructs, parallelism, databases and performance. For almost two decades he contributes to open-source, i.e. FirebirdClient. He works as a senior software engineer for Microsoft. Frequent speaker and blogger at www.tabsoverspaces.com.