You have to explicitly eager load the Customers navigation property on ReservationRequestSet : var c = dataContext. ReservationRequestSet. Include("Customers") .
FirstOrDefault(i => i. Id == RequestId) As of . NET 4, EF performs lazy loading by default but since you are developing a web application I would suggest to turn it off and always use Eager Loading as it might want to attempt to do lazy loading when your object context is closed, therefore cause an exception which is a very typical scenarios in Web and WCF applications.
You have to explicitly eager load the Customers navigation property on ReservationRequestSet: var c = dataContext. ReservationRequestSet. Include("Customers") .
FirstOrDefault(i => i. Id == RequestId); As of . NET 4, EF performs lazy loading by default but since you are developing a web application I would suggest to turn it off and always use Eager Loading as it might want to attempt to do lazy loading when your object context is closed, therefore cause an exception which is a very typical scenarios in Web and WCF applications.
You're the man. – jim Nov 1 '10 at 19:39 No problem dude :) – Morteza Manavi Nov 1 '10 at 20:03.
If you're using Entity Framework v1, you have to explicitly load children like (to load after you retrieve the Entity): if(!c. CustomersReference. IsLoaded) c.
CustomersReference.Load(); Or (to eager load when you retrieve the Entity): var c = dataContext. ReservationRequestSet . Include("Customers") .
FirstOrDefault(i => i. Id == RequestId); If you're using Entity Framework v4, you could try using the new Lazy-Loading feature: using(YourContext db = new YourContext()) { db.ContextOptions. LazyLoadingEnabled = true; // query here } If you go this route, you shouldn't have to worry about explicitly loading navigation properties at all.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.