title: Getting child class type from parent class parameter
body: <p>I am going to have multiple "types" of an object and I am really not sure how best to retrieve/save those multiple types without having a separate save/retrieve for each type.</p>
  
  <p>My classes:</p>
  
  <pre><code>public class Evaluation {
    public int Id
    public string Comment
  }
  
  public class EvaluationType_1 : Evaluation {
    public string field
  }
  
  public class EvaluationType_1 : Evaluation {
    public string field
  }
  </code></pre>
  
  <p>What I would like to do in my repository:</p>
  
  <pre><code>public interface IEvaluationRepository {
    public Evaluation getEvaluation(int id);
    public SaveEvaluation(Evaluation);
  }
  </code></pre>
  
  <p>Inside the get/save methods:</p>
  
  <pre><code>// Save/get common fields
  Id
  Comments
  
  // Get child type, perform switch
  Type childType = ???
  switch(childType) {
    // Set child-specific fields
  }
  </code></pre>
  
  <p>I'd rather not add a "type" column as I have this in another part of my database and I am not really liking it too much</p>
  
  <h2>Update</h2>
  
  <p>Here's more info for clarification, if necessary.</p>
  
  <p>I love the idea of using interfaces and generics, I'm really at a loss for how to incorporate them into my repository pattern.</p>
  
  <p>When I call <code>getEvaluation</code>, I want it to return an abstract Evaluation, but I'm struggling with this code.  Same with Saving.</p>
  
  <h2>Update 2</h2>
  
  <p>Daniel is helping me hone in on what exactly I am trying to ask.</p>
  
  <p>Database:</p>
  
  <pre><code>Evaluations
    Id (PK)
    Comment
  
  EvaluationType1
    Id (FK to Evaluations.Id)
    Field
  
  EvaluationType1
    Id (FK to Evaluations.Id)
    Field
  </code></pre>
  
  <p>So, in <code>getEvaluation(int id)</code>, I need to figure out what type of Evaluation they want.  Does this mean I should pass in a type?  Same is true in <code>saveEvaluation</code>, But I can do a switch/function map to see what <code>Type</code> it is.</p>