title: Cannot perform a shrinkdatabase operation inside a user transaction. Terminate the transaction and reissue the statement
body: <p>While executing the below mentioned query in C# using Entity Framework, an error occurs. This query can be successfully executed in SQL Server Management Studio. But it's not working when called from  C# code. Please, anyone help me.</p>
  
  <pre><code>var RunStoredProcedure1 = _context.Database.ExecuteSqlCommand("USE MDRFDataBase;  DBCC SHRINKDATABASE(N'MDRFDataBase' );  ");
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Cannot perform a shrink database operation inside a user transaction. Terminate the transaction and reissue the statement.</p>
  </blockquote>