title: Custom setter for C# model
body: <p>I don't know how to make custom setter for C# data model. The scenario is pretty simple, I want my password to be automatically encrypted with SHA256 function. SHA256 function works very well (I've used in in gazillion of projects before).</p>
  
  <p>I've tried couple of things but when I run <code>update-database</code> it seems it's doing something recursively and my Visual Studio hangs (don't send error). Please help me understand how to make passwords be encrypted by default in model.</p>
  
  <h2>Code with what I've already tried</h2>
  
  <pre><code>public class Administrator
  {
      public int ID { get; set; }
      [Required]
      public string Username { get; set; }
      [Required]
      public string Password
      {
          get
          {
              return this.Password;
          }
  
          set
          {
              // All this code is crashing Visual Studio
  
              // value = Infrastructure.Encryption.SHA256(value);
              // Password = Infrastructure.Encryption.SHA256(value);
              // this.Password = Infrastructure.Encryption.SHA256(value);
          }
      }
  }
  </code></pre>
  
  <p>Seed</p>
  
  <pre><code>context.Administrators.AddOrUpdate(x =&gt; x.Username, new Administrator { Username = "admin", Password = "123" });
  </code></pre>