none
Performance Issue between Stored Procedure and EF Code First RRS feed

  • Question

  • If I want to retrieve a list of data and display it by using EF code first (http://msdn.microsoft.com/en-in/data/dn468673) or stored procedure (http://msdn.microsoft.com/en-us/data/jj592907.aspx), which of them has the shortest time to retrieve it?
    Friday, December 26, 2014 9:20 PM

All replies

  • EF uses  an internal MS SQL Server sproc to submit generated T-SQL from the EF engine to be executed, with all the benefits of using a sproc.  

    You problem will be what kind of Linq query you created that in turn generates the T_SQL to be submitted by an ORM like EF. Bad Linq query creation can lead to bad generated T_SQL submitted.

    The other problem you face is object materlization, because EF an ORM generates the results of a query in the form of a single object or a collection of objects in a tubular form. 

    You face the same problem when you execute a sproc of your own creation of how to get the data out form the sproc by means of a datatable or usage of a collection of objects.

    Sunday, December 28, 2014 2:20 PM