EF Business Classes in ASP.NET Apps - Don't pass that query around!
Posted by: Julia Lerman Blog - Dont Be Iffy...,
on 31 Aug 2008 |
View original | Bookmarked: 0 time(s)
Here's a little sidebar from my book that I think is pretty important.
Return Results, not Queries from the Business classes
While you can get away with binding a query when working directly in the code behind
of an ASP.NET page, remember that the querys job is to be executed and return results.
Query execution requires an ObjectContext. If you returned the query itself from a
business class, it will be detached from the context as soon as the business object
is disposed (the business object,...