title: C# How to deserialize the Json to a generic entity use base-class?
body: <p>I need to convert JSON object to entity, 
  I have many entities and I don't want to write my code some times, so I built an entity-base class and I want to do deserialize to entity (without know which derived-entity call to the base-entity).</p>
  
  <p>Can I do it?</p>
  
  <p>This is my base class (It is abstract class)</p>
  
  <pre><code>  public abstract class AbstractEntity
  {
      EntityState EntityState { get; set; }
      DateTime CreatedDate { get; set; }
      DateTime? ModifiedDate { get; set; }
      string CreatedBy { get; set; }
      string ModifiedBy { get; set; }
  
      public EntityState getEntityState()
      {
          return EntityState;
      }
      public void SetEntityState(EntityState entityState)
      {
          EntityState = entityState;
      }            
  }
  </code></pre>
  
  <p>The first ent:</p>
  
  <pre><code>public class TABLE1: AbstractEntity
  {
      public TABLE1();
  
      public string ID{ get; set; }
  
      public string ADDRESS{ get; set; }
      public virtual ICollection&lt;TABLE2&gt; TABLE2 { get; set; }
  }
  </code></pre>
  
  <p>The second ent:</p>
  
  <pre><code>public class TABLE2: AbstractEntity
  {
      public TABLE2();
  
      public string ID{ get; set; }
  
      public string ADDRESS{ get; set; }
      public virtual TABLE1 TABLE1{ get; set; }
  }
  </code></pre>