Is this a violation of MVC in the strict sense, yes, perhaps. Are there times when there is no harm in violating this? Of course. However, there are mechanisms to help you figure out and leave problems.
You can use your saved domain objects in the views and check them, but when your look starts to get complicated, ViewModels become a necessity. For dead simple domain models or view-only views (doesn't edit / create), I sometimes make up a little and send them to the view as part of a composite object:
class MyViewModel { public MyDomainModel DomainObj; public int OtherViewInfo; }
However, for creation and editing scenarios, ViewModels is much better. They allow you to fully control the data sent to and from the view.
If you use EF 4.1 and CodeFirst, then yes, you will get some duplication of attributes and properties between the domain and the ViewModel. This is inevitable, but gives you the flexibility to perform various checks specific to the presentation.
I found it useful to have one additional level of protection in the controller when actually saving the domain object in case I missed some verification in the view:
public class MyController : Controller { [HttpPost] public ActionResult Edit(int id, MyViewModel model) { try { ...Do stuff, check ModelState.IsValid... _context.SaveChanges() } catch (DbEntityValidationException dbEx) {
The next question you want to ask is the mapping between the domain model and the ViewModel. There are many strategies and tools - AutoMapper and ValueInjecter (yes, incorrectly spelled). Personally, I used ValueInjecter, although if you customized the display layer, you can try both. I found that none of them will work 100% of the time, or at least I could figure out how to do what I need, but the mapping service makes it easy to define custom maps from left to right.