title: DbContext won't keep connection open for re-use
body: <p>I'm trying to reuse an existing database connection so that I can do multiple database operations using a <code>TransactionScope</code> without invoking MSDTC.</p>
  
  <p>Entity Framework (using the new <code>DbContext</code> API in the 4.1 release) doesn't seem to want to keep an explicitly-opened connection open. The old <code>ObjectContext</code> API keeps the connection open as expected and <a href="http://msdn.microsoft.com/en-us/library/bb896325.aspx" rel="noreferrer">documented</a>.</p>
  
  <p>Since the <code>DbContext</code> API just uses <code>ObjectContext</code> under the hood, I'd have expected the same behaviour. Does anyone know if this change is intended or a known issue? I can't find it documented anywhere.</p>
  
  <pre><code>public void ConnectionRemainsOpen()
  {
      using (var context = new TestDataContext())
      {
          try
          {
              Assert.AreEqual(ConnectionState.Closed, context.Database.Connection.State);
  
              context.Database.Connection.Open();
  
              var firstRecord = context.Table3.FirstOrDefault();
  
              // this Assert fails as State == ConnectionState.Closed
              Assert.AreEqual(ConnectionState.Open, context.Database.Connection.State);
  
              var newRecord = new Table3
              {
                  Name = "test",
                  CreatedTime = DateTime.UtcNow,
                  ModifiedTime = DateTime.UtcNow
              };
  
              context.Table3.Add(newRecord);
  
              context.SaveChanges();
  
              // this Assert would also fail
              Assert.AreEqual(ConnectionState.Open, context.Database.Connection.State);
          }
          finally
          {
              if (context.Database.Connection.State == ConnectionState.Open)
                  context.Database.Connection.Close();
          }
      }
  }
  </code></pre>