title: Create Transaction with context and sql command, C#
body: <p>I would like to create one transaction of two saves: one via entity framework's context and the other using sql command.</p>
  
  <p>How do i get the connection of one, pass it to the other and create a transaction?</p>
  
  <p>For example:</p>
  
  <pre><code>var ctx = ApplicationContext();
  var tr = ctx.Transaction.where(x=&gt;x.id=1);
  tr.status = 5;
  ctx.SaveChanges();
  
  using (SqlConnection connection = new SqlConnection(ConnectionString))
   {
     using (SqlCommand command = new SqlCommand(query, connection))
     { //set query and params
       connection.Open();
       command.ExecuteNonQuery();
  
      }
  </code></pre>