How would you use EF in a typical business level / data access / stored procedure setup?

Whenever I watch a demo regarding the Entity Framework, the demonstrator simply sets up some tables and performs inserts, updates, and deletes using automatically generated code stubs, but never shows the use of stored procedures. It seems to me that this is SQL execution from the client.

In my experience, this is not a good practice, so I assume that my understanding of the Entity Framework is incorrect.

Similarly, WCF RIA Services demos use EF and the demos are always the same. Can anyone shed some light on how you will use EF in a typical business level / data access / stored procedure setup.

I think I am confused and should not be !!?

+3
source share
5 answers

There is nothing wrong with executing SQL from a client. Most (if not all) of the problems that may arise do not actually exist when using something like EF. For instance:

  • Client-side SQL may cause syntax errors at runtime. This is unlikely, since the description of your query is mostly checked at compile time (assuming the generator itself does not generate invalid SQL, which is also unlikely)
  • SQL- . , . EF , , .. SQL ( , ) .
  • SQL- (SQL- ). , .
+6

/ db .

, O/RM SQL DB.

+4

: , .

, , , , !

+1

, , sql , , - db , (proc), ( , sql). Entity Framework , .

, procs, , ( ) . , , . EF - , , , .

+1

, Scott Hanselman : " , - datagrid" (. 478 Silverlight 4 In Action, )

, , , , . , , .

Regarding your comments on stored procedures and various answers to your question about the generator. The generator is good and getting better. Howerver has certain circumstances when it will generate completely unused requests. (see my SO question here and discussed in the ADO.NET team blog )

Therefore, there are times when manually created queries are your only resource (or using stored proc functions, table values, views, etc.)

+1
source

Source: https://habr.com/ru/post/1778778/


All Articles