title: ASP.NET MVC data annotate domain model in the web project
body: <p>I've seen somewhere how to do this before on a blog but I forgot where or how. Lets say I have a domain in a class library. I'd like to data annotate the properties of this domain as my viewmodel in the web project.</p>
  
  <p>How do I accomplish this?</p>
  
  <p>For example. This domain is in my class library:</p>
  
  <pre><code>public class Person {
     public int Id {get; set;}
     public string FirstName {get; set;}
  }
  </code></pre>
  
  <p>In my web project, there is this:</p>
  
  <pre><code>//Do i need to set some attribute here?
  public class CreatePersonViewModel{
  
     [Required()]
     [DisplayName("First Name")]
     public string FirstName {get; set;}
  }
  </code></pre>
  
  <p>This code can be mapped to <code>Person</code> without a tool. Probably partial or something.</p>