locked
Efficient use about CRUD Tran Vs Stored Procedure RRS feed

  • General discussion

  • I am new using entity framework, and i would like to know, It is more efficient use the CRUD transaction from entity directly or using an stored procedure. What is the best way?
    • Changed type Fred Bao Tuesday, May 27, 2014 5:44 AM The discussion type is more suitable for this case
    Thursday, May 15, 2014 6:48 PM

All replies

  • You can have CRUD operation methods in a DAL Data Access Layer,  the method can use System.Transactions, and the method can be doing Create,  Read, Update or Delete within a Transaction scope. Using a sproc in this situation buys you nothing and it's just an unneeded obstacle.
    Thursday, May 15, 2014 7:33 PM
  • Could you most specific. Are the SQL Server execution plans created using CRUD more efficient?
    Thursday, May 15, 2014 7:43 PM
  • EF uses the internal system SQL Server Stored Procedure to submit EF generated T-SQL to be executed, which gives all of the of benefits provided by running a  stored procedure.  

    <http://blogs.msdn.com/b/bindeshv/archive/2010/07/13/ef-query-execution-pattern-usage-of-sp-executesql-vs-direct-execution-of-sql-statement.aspx?Redirected=true>

    Thursday, May 15, 2014 10:03 PM
  • Ok, i know about that, but my question is what is more efficient sproc or using T-SQL from ET?. How EF make the query in T-SQL? I can define the relation's order and "WHERE" condition order?
    Friday, May 16, 2014 1:58 PM
  • Ok, i know about that, but my question is what is more efficient sproc or using T-SQL from ET?. How EF make the query in T-SQL? I can define the relation's order and "WHERE" condition order?

    I suggest that you use a SQL Profiler and find out for yourself as to who is doing what. I suggest that you start using Being or Google and find articles out there that are going to answer your questions. That's the best I can do for you.

    Friday, May 16, 2014 2:10 PM
  • Thanks for your effort helping me, I will continue your suggestion and I will try to get the answer.

    Friday, May 16, 2014 3:33 PM