I'm just wondering. And been looking in Deferred Execution. It says here http://msdn.microsoft.com/en-us/library/bb943859.aspx that Deferred execution means that the evaluation of an expression is delayed until its realized value is actually required.

What does "Until its realized value is actually required" means? Are there methods or property for the value to be realized? Just like the .ToList()

Hope you get what I'm pointing on.

有帮助吗?

解决方案

Deferred execution is used to mean that no database query will be fired until an IQueryable is iterated.

Let say.

    var employees = db.Employees.Where(x=>x.FirstName == "Krish"); //No query issued
var count = employees.Count(); // now a query is issued

其他提示

Execution of the query is delayed until the query is actually enumerated. A foreach loop or calling .ToList() will force the query to be executed.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top