Vinay Phadke

Vinay Phadke

  • NA
  • 4
  • 654

SP execution using Entity framework vs SqlCommand+ reader

Jun 14 2016 10:38 AM
&nbsp;<p>Hi,&nbsp;</p><div>Why does SP called from EF(I'm using version 6.1.3) takes time as compared toSP execution time of SQLCommand's ExecuteNoNQuery() &amp; Datareader? I'm making an Async call using EF like below- </div> <font face="Courier New" size="2"><font face="Courier New" size="2"><p>public async Task&lt;IList&lt;T&gt;&gt; ExecSPAsync&lt;T&gt;(string query)</p> <p> {</p> <p> return await Context.Database.SqlQuery&lt;T&gt;(query).ToListAsync();</p> <p> }</p> </font></font><p>Use of SQLCommand/SQLDatareader seems to be much efficient compared with SP call using EF. What would be the efficient way of calling SP using EF?</p>