title: How to run stored procedures using IDataContext interface?
body: <p>Issue: I'm trying to run a stored procedure in a controller that implements the <code>IDataContext</code>.  </p>
  
  <p>I know how to call <code>databaseContext.Database.SqlQuery &lt;string&gt;</code>... but in the <code>IDataContext</code> the <code>Database</code> class isn't exposed. I'm looking for an example of the proper way to expose the <code>Database</code> class in an <code>IDataContext</code> interface, so that I can mock the <code>IDataContext</code> properly and be able to call <code>IDataContext.Database.SqlQuery&lt;string&gt;</code>....... </p>
  
  <pre><code>public class MyController : ODataController
  {
      private  IDataContext _db = new DataContext();
  
      [HttpPost]
      [ODataRoute("RunFile()")]
      public IHttpActionResult RunFile()
      {
          //..code omitted for brevity
          var result = _db.Database.SqlQuery&lt;int&gt;("exec MyStoredProc").ToList();
          return Ok(result);
      }
  }
  </code></pre>
  
  <p>I've seen a similar question to the one I'm asking but I'm looking for an example of the answer that was posted in this question. <a href="https://stackoverflow.com/questions/15441398/how-do-you-execute-native-sql-using-entity-framework-when-using-the-datacontext?answertab=votes#tab-top">link to Original post</a></p>
  
  <p>Basically looking for and example of how to expose the <code>Database</code> class in the <code>IDataContext</code>. </p>