Deferred execution

I would like to know if lazy loading == will be delayed execution?

+3
source share
2 answers

No.

Lazy loading is usually used to indicate that if you have an instance of an object with a property related to some other entity, dereferencing the property in the code will result in a database query to materialize that other object if it is not already loaded.

eg:

var foo = Context.Foos.First();
var bar = foo.Bar; // with lazy loading, this causes a DB query for foo.Bar;

"Delayed execution" is usually used to indicate that the database query will not be issued at all until it is repeated IQueryable.

eg.

var foos = context.Foos.Where( f => f.Id == id); // no db query ; deferred
var foo = foos.First(); // now a query is issued.
var count = foos.Count(); // another query is issued
+9
source

, " " Entity Framework 4, , .

-1

Source: https://habr.com/ru/post/1731249/


All Articles