ARLCode ARLCode - 23 days ago 18
C# Question

Lazy Loading Examples?

I'm building a basic MVC Core Web API and trying to connect using Entity Framework, I came across something called "Lazy Loading" and I can't seem to wrap my head around what Lazy Loading is revolving EntityFramework?

When is Lazy Loading used and how does it benefit?

Answer

In my opinion, Lazy loading is the process when an entity or collection of entities is automatically loaded from the database.

Actually, the sorting and retrieval algorithms are being applied on the user side, while query gets all the data. By the default the Lazy Loading feature is ON, but can be turned off manually, or you can construct clever queries, i.e. using IQueryable, which does the filtering on Server side and retrieves only those records, which are required. In practices, it will help you to save a lot of time and resources, by preventing the heavy traffic and overloading server

Better answer is on this website-> https://msdn.microsoft.com/en-us/library/jj574232(v=vs.113).aspx

Comments