質問

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