title: Nested DbContext due to method calls - Entity Framework
body: <p>In the following case where two DbContexts are nested due to method calls:</p>
  
  <pre><code>public void Method_A() {
      using (var db = new SomeDbContext()) {
          //...do some work here
          Method_B();
          //...do some more work here
      }
  }
  
  public void Method_B() {
      using (var db = new SomeDbContext()) {
          //...do some work
      }
  }
  </code></pre>
  
  <p>Question:</p>
  
  <ol>
  <li><p>Will this nesting cause any issues? (and will the correct DbContext be disposed at the correct time?)</p></li>
  <li><p>Is this nesting considered bad practice, should Method_A be refactored into:</p>
  
  <pre><code>public void Method_A() {
      using (var db = new SomeDbContext()) {
          //...do some work here
      }
  
      Method_B();
  
      using (var db = new SomeDbContext()) {
          //...do some more work here
      }
  }
  </code></pre></li>
  </ol>
  
  <p>Thanks.</p>