Hi,
I am creating a webapp using entity framework 4. As far as I can tell from extensive googling, it is best practice to create and kill the objectcontext when it is being used, and not let it live too long. So in my datalayer, I am doing something like:
using (var context = new MyDAO()) { MY CODE } creating and killing the context right away.
One of the things I like about entity framework is the ability to work with related objects directly in your code (eg. Account.Employees). The problem is, that when I try to do this in my presentationlayer, it throws an exception since the context is no longer available, so it cannot fetch the employees for the account. I have tried enabling lazyloading on the context in my datalayer, but it doesn't seem to work.
So my questions is, how do I get the relationships (lazy)loaded across different tiers?
Thanks Thomas