title: ASP.NET MVC: using EF entities as viewmodels?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1498927/asp-net-mvc-linq-to-entities-model-as-the-viewmodel-is-this-good-practice">ASP.NET MVC - Linq to Entities model as the ViewModel - is this good practice?</a>  </p>
  </blockquote>
  
  
  
  <p>Is is OK to use EF entities classes as view models in ASP.NET MVC?</p>
  
  <p>What if viewmodel is 90% the same of EF entity class?</p>
  
  <p>Let's say I have a Survey class in Entity Framework model. It 90% matches data required for view to edit it.
  The only difference from what view model should have - is one or several properties to be used in it (that are required to populate Survey object because EF class cannot be directly mapped onto how it's properties are represented (sub-checkboxes, radio groups, etc.))</p>
  
  <p>Do you pass them using ViewData[]? Or create a copy of Survey class (SurveyViewModel) with new additional properties (it should be able to copy data from Survey and back to it)?</p>
  
  <p><strong>Edit:</strong>
  I'm also trying to avoid using Survey as SurveyViewModel property. It will look strange when some Survey properties are updated using UpdateModel or with default binder, while others (that cannot be directly mapped to entity) - using SurveViewModel custom properties in controller.</p>