title: Why Virtual Method of Derived Class is not able to be use
body: <p>First of all, although the code shown below contains Entity Framework, this question is completely related to OOP and C#.</p>
  
  <p>I have a class derived from <code>DbContext</code>, having virtual property <code>haberler</code> and a derived class <code>MyDbContext</code> derived from <code>DbContext</code>.</p>
  
  <pre><code>public class HaberContext : DbContext
    {
       public virtual DbSet&lt;Haber&gt; haberler { get; set; }
    }
  
  public class Haber { }
  </code></pre>
  
  <hr>
  
  <p>Instanting MyClass with like <code>haberler</code></p>
  
  <pre><code>DbContext context = new HaberContext();  // [ERROR]
  </code></pre>
  
  <p>with like this even if using <code>new HaberContext()</code>;
  prevent me to use the virtual property named <code>haberler</code></p>
  
  <blockquote>
    <p>Error  1   <code>System.Data.Entity.DbContext</code> does not contain a definition for <code>haberler</code> and no extension method <code>haberler</code> accepting a first argument of type <code>System.Data.Entity.DbContext</code> could be found (are you missing a using directive or an assembly reference?)   c:\csharpprojects\entitycodefirst\entityframework-haberportal\gui.cs<br>
    37 27  EntityFrameWork-HaberPortal</p>
  </blockquote>
  
  <p>Notice that <code>DbContext</code> is the base class of <code>HaberContext</code></p>
  
  <p>I have to instantiate the <code>MyDbContext</code> with:</p>
  
  <pre><code>HaberContext context = new HaberContext(); // [OK]
  </code></pre>
  
  <p>Or with Implicitly Typed Local Variable like this:</p>
  
  <pre><code>var context = new HaberContext();  // [OK]
  </code></pre>