title: Accessing Properties or a Parent Class from Base
body: <p>I am attempting to create an application which interacts with a database.</p>
  
  <p>I program in many languages and I loved how easy it was to use Models in an MVC based application.</p>
  
  <p>So my question is, trying to replicate this functionality, I have 2 classes as follows:</p>
  
  <p>Base Class:</p>
  
  <pre><code>public class BaseModel
  {
      protected string TableName { get; set; }
  
      public BaseModel()
      {         
      }
  
      public void Save()
      {
          // Save data in derived class to table stored in TableName
      }
  }
  </code></pre>
  
  <p>Derived Class:</p>
  
  <pre><code>public class UserModel : BaseModel
  {
      public string Field1 { get; set; }
      public string Field2 { get; set; }
  
      public UserModel()
      {
          base.TableName = "user";
      }
  }
  </code></pre>
  
  <p>From my main application, i want to be able to do the following:</p>
  
  <pre><code>public class Class1
  {
      public Class1()
      {
          UserModel model = new UserModel();
          model.Field1 = "Value1";
          model.Field2 = "Value2";
          model.Save();
      }
  }
  </code></pre>
  
  <p>Here is where i have hit a problem. I cannot for the life in me figure out, how i would be able to access the properties in UserModel so they can be saved to the database table specified in in the constructor of UserModel to the BaseModel.</p>
  
  <p>Hope this made sense. :)</p>
  
  <p>This code is not my working code, it is a very simple representation of what i would like to achieve so Fields and properties (validators etc) have been dumbed down for ease of reading.</p>