title: Mapping database table to class
body: <p>I'm writing an application with ASP.NET MVC2. In the tutorial I'm following for registration, the author mentions mapping a database table to my <code>User</code> class to make it easy to insert the user once they pass validation checks, but he doesn't explain how to do that.</p>
  
  <p>These are the attributes of my <code>User</code> class:</p>
  
  <pre><code>public string Username { get; set; }
  public string Email { get; set; }
  public string Password { get; set; }
  public string ConfirmPassword { get; set; }
  </code></pre>
  
  <p>They have DataAnnotation validations as well. I also made a database table on a remote server (hosted at my University) called <code>Users</code> which has the following fields:</p>
  
  <pre><code>Id
  Username
  Email
  Password
  </code></pre>
  
  <p>How can I map them and then easily save the user to the database?</p>
  
  <p>Thanks.</p>