I have a project structured as follows: .Persistence -> .Repo -> .Services -> .Controllers -> MVC3 App.
Each layer has a respective assembly with interfaces and there's also some other assemblies like .Entities, .ViewModels, and common code assemblies.
Persistence - This holds the EF4 datacontext (code-first) and a reference to EF4.3. There's a factory for creating the Context called GetContext() and this factory implements IDisposable. It is NOT a singleton cause I figured that's what windsor would do for me with LifestyleSingleton().
Repo - This holds repositories implementing the repository and specification pattern (http://huyrua.wordpress.com/2010/07/13/entity-framework-4-poco-repository-and-specification-pattern/).
The other layers are self-explanatory...
Questions:
1. Why does proxy creation have to be enabled when lazy loading is enabled?
2. If I want to set lazyloading = false, can I cast my IEnumerable in Service layer to ObjectQuery in order to use .Include() there?