title: Exclude property of model in insert Entity Framework
body: <p>I get an error when inserting data into my database. My database columns are:</p>
  
  <pre><code>username, password 
  </code></pre>
  
  <p>and I added <code>confirmpassword</code> to the model to extend it.</p>
  
  <p>How do I get rid of the <code>confirmpassword</code> to insert the username and password while using the model with <code>confirmpassword</code> property?</p>
  
  <p>My code:</p>
  
  <pre><code>BootstrapTrainingEntities db = new BootstrapTrainingEntities();
  
  var u = new User();
  
  u.username = user.username;
  u.password = user.password;
  // how to I remove or ignore the confirmPassword property when saving?
  
  db.Users.Add(u);
  db.SaveChanges();
  </code></pre>
  
  <p>Model</p>
  
  <pre><code>[MetadataType(typeof(metadataUser))]
  public partial class User
  {
      public string confirmPassword { get; set; }
  }
  
  public class metadataUser
  {
      [Required(ErrorMessage = "Username is required", AllowEmptyStrings = false)]
      [Display(Name ="Username")]
      public string username { get; set; }
  
      [Required(ErrorMessage ="Password is required", AllowEmptyStrings = false)]
      [Display(Name = "Password")]
      [DataType(DataType.Password)]
      public string password { get; set; }
  
      [Required(ErrorMessage ="Confirmation Password is required", AllowEmptyStrings = false)]
      [Display(Name ="Confiramation Password")]
      [DataType(DataType.Password)]
      [Compare("password",ErrorMessage = "Password does not match")]
      public string confirmPassword { get; set; }
  }
  </code></pre>