I am exploring Entity Framework 4 with POCO as my Model for an MVC2 web app. The reason I\'ll need the model and data access code in a separate library is so I can share it
I never liked "Models" folder anyway. I rather put separate layers/tiers in separate assemblies. MVC project template just makes a layered application in a single assembly.
I prefer solutions made of several projects:
This is a much more controllable and structured way if your application is larger than just a few trivial screens.
So in a past project: EF model was in the Data project (as well as repositories etc), and POCOs where in Objects. All communication between projects was done with classes from Objects project.
So Web used Services,
which in turn used repositories (in Data),
which in turn called EF to manipulate data.
All data passing back and forth was using POCOs in Objects.
So repositories had to transform entities to actual POCOs (they were not 1:1) when returning data and creating entities when there were write operations. And this transformation was done via extension methods on entities, so transformation was always done in a single method, which made it simpler to maintain when we either changed an entity or a POCO class. We didn't have to scan all the code for all conversions, we just adjusted our ToPoco()
extension method (they were actually called like this).