title: Applying MVVM to ASP.NET MVC. How to do property mapping?
body: <p>There are a lot of articles about using MVVM patterm for ASP .NET MVC. For example, it is <a href="http://blogs.microsoft.co.il/blogs/helpercoil/archive/2010/08/28/asp-net-mvc-and-the-mvvm-pattern.aspx" rel="nofollow">http://blogs.microsoft.co.il/blogs/helpercoil/archive/2010/08/28/asp-net-mvc-and-the-mvvm-pattern.aspx</a>. </p>
  
  <p>There is only one question for me. We have a lot of ViewModels for one Model. How can I fill Model properties automatic by using viewModel object? How to make automatic property mapping?</p>
  
  <p>I use Entity Framework.</p>
  
  <p>For example, I have model Test with the following properties:</p>
  
  <ul>
  <li>id</li>
  <li>name</li>
  <li>title</li>
  <li>idUser</li>
  <li>idCompany</li>
  </ul>
  
  <p>I made ViewModel for my task. This ViewModel (TestUserViewModel) uses for simple user with the following properies:
   - id
   - name
   - title</p>
  
  <p>For example, user edit an existing test. As the result, we have an object with type TestUserViewModel. I want:</p>
  
  <ul>
  <li>synchronize Model object and ViewModel. </li>
  <li>save the default valies for idCompany, idUser - for properties, which were excluded from current ViewModel.</li>
  <li><p>use some automatic stuff - it may be something like ApplyCurrentValues. I really don't want to write a lot of following code:</p>
  
  <pre><code>modelObj.name=viewModelObj.name;
  modelObj.title=viewModelObj.title;
  </code></pre></li>
  </ul>
  
  <p>Using System.Reflexion for this looks like bad, too.</p>
  
  <p>So, how to do it?</p>