Reputation: 73938
I had a look at EF 4 (Entity Framework) from MS.
I understand its use for separation of Layer Logic as DAL.
In EF 4 I see it is possible to create code for query the Data Base, query are stored in DAL.
My questions is what could be the benefit of using SPROC with EF 4?
To me calling SPROC from the EF 4 seems not maintaining a clear division between layers.
Any 'gotchas' on topic of best practice for EF 4 and SPROC?
Thanks guys your usual great support!
Upvotes: 0
Views: 222
Reputation: 5213
There are a few reasons why you might want to use EF with stored procedures. First, your company's DBA might require all stored proces (granted, this is a different debate but unfortunately sometimes you're not given a choice) - in this case using EF with stored procedures still allows you to use the rich mapping framework and save yourself from writing a ton of code wiring up columns to properties.
Also, ORM's like EF are great at modeling your typical CRUD operations. However, you might have a very complex query where it's easier to model it with straight SQL than an EF query. In this case a sproc would be desirable as well (and still you're leveraging the EF mapping capabilities).
Upvotes: 1