title: Unit testing with database created by Entity Framework with Effort and dbContext
body: <p>I am trying to create fake database instance using Effort, but I encountered to a problem. <code>ObjectContextFactory</code> has a <code>CreateTransistent</code> generic method which expects an <code>ObjectContext</code> type to be defined:</p>
  
  <pre><code>public static T CreateTransient&lt;T&gt;( ) where T : ObjectContext;
  </code></pre>
  
  <p>So as far as I understand generic types I can define:</p>
  
  <pre><code>class MyObjectContextClass : ObjectContext
  {
     //Entity definition here
  }
  </code></pre>
  
  <p>So I can do following in unit test class:</p>
  
  <pre><code>var effortContext = ObjectContextFactory.CreateTransient&lt;MyObjectContextClass&gt;()
  </code></pre>
  
  <p>So far so good, right? But my context class inherits from <code>dbContext</code> class:</p>
  
  <pre><code>class MyRealDbContextClass : DbContext
  {
      // Entity definition here
  }
  </code></pre>
  
  <p>I found that <code>DbContext</code> is a wrapper class and it consist of <code>ObjectContext</code></p>
  
  <p>So my question is: how can I retrieve type of my custom <code>ObjectContext</code> so I can use it in effort static method? I need something like:</p>
  
  <pre><code>var type = MyRealDbContextClass.GetObjectContextType();
  </code></pre>
  
  <p>So I can:</p>
  
  <pre><code>var effortContext = ObjectContextFactory.CreateTransient&lt;type&gt;()
  </code></pre>