title: Using setter for work with database
body: <p>In project I have the class - model class (call this class - <code>modelClass</code>).</p>
  
  <p>And I have a class  (call this class - <code>dbClass</code>) which provide some methods for work with database (db - Advantage database architecture). This class provide static methods for work with database. I know that I can use some ORM(like EF), repository pattern, but in this project the main idea for work with database this is static class with static methods.</p>
  
  <p>In modelClass I have thi field - "<code>Status</code>" (string type).</p>
  
  <p>My use-case is update record in database when I set the filed "<code>Status</code>".</p>
  
  <p>You can see my solution below:</p>
  
  <pre><code>public class modelClass{
      //here some fileds
      public string Status { get; set; }
      //here some fileds
  }
  
  public class dbClass{
      //here some fileds and method for work with database
      public static void update(modelClass mClass){
          //here update the record in database
      }
  }
  </code></pre>
  
  <p>using</p>
  
  <pre><code>....
  modelClass.Status = "status";
  dbClass.update(modelClass);
  ....
  </code></pre>
  
  <p>I came up with another solution. </p>
  
  <p>The idea of my decision is to use keyword "<code>set</code>".</p>
  
  <p>Let me explain my idea - when I set the field in modelClass I want to set field and update record in database.</p>
  
  <p>For example:</p>
  
  <pre><code>public class modelClass{
      //here some fileds
      private string Status { get; set; }
  
      //create public setter
      public string setStatus{
          get { return Status; }
          set
          {
              Status = value;
              dbClass.update(this);
          }
      }
  
      //here some fileds
  }
  </code></pre>
  
  <p>using</p>
  
  <pre><code>modelClass.setStatus= "status";
  </code></pre>
  
  <p><strong>The main questions is:</strong></p>
  
  <ol>
  <li>Is it good practice work with database by setter? </li>
  <li>Why I should/shouldn't use this idea?</li>
  <li>Please explain me main pros and cons of my idea</li>
  </ol>