Single assembly projects only for small projects
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:
- Web - front end web application ie. Asp.net MVC (references Services and Objects)
- Services - business tier assembly (references Data and Objects)
- Objects - POCO classes, interfaces etc. that are shared all over (doesn't reference any other solution project)
- Data - The actual EF model and extensions, repositories etc (references Objects)
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).