title: Entity Framework Core: How to get the Connection from the DbContext?
body: <p>I am trying the new Entity Framework Core with MySQL Connector. </p>
  
  <p>I can get a valid <code>DbContext</code> and write into the database so everything has been setup correctly. </p>
  
  <p>I need to get the <code>Connection</code> from the <code>DbContext</code> because I have to test for it at application starting using a <code>connection.Open()</code> inside a <code>try</code> statement. If there is not a valid connection, the console app should try to start MySQL Server and retry.</p>
  
  <p>How can I get the <code>Connection</code> from the <code>DbContext</code>?</p>
  
  <p>Before EF6 by <code>context.Connection</code>. After EF6 by <code>context.Database.Connection</code>.</p>
  
  <p>It seems the latest has been removed too from EFCore.</p>