Blending stored procedure business logic and ORM

The company I work with is developing a large application that is almost entirely based on stored procedures.

We use classic ASP and SQL Server, and the bulk of the business logic is contained within these stored procedures.

For example, (I know this is bad ...) one stored procedure can be used for different purposes (insert, update, delete, perform some calculations, ...). In most cases, a stored procedure is used for operations on linked tables, but this is not always the case.

We plan to migrate to ASP.NET (WebForms) in the near future.

I read a lot of posts that StackOverflow recommends moving business logic outside of the database. The fact is that I tried to convince people who make decisions in our company, and I can not do anything to change my mind .

Since I want to take advantage of object-oriented programming, I want to map tables to actual classes. So far, my solution has been to use ORM (Entity Framework 4 or nHibernate) to avoid manually matching objects (mainly to retrieve data) and use some level of data access to call existing stored procedures (to save).

I want your advice on this. Do you think this is a good solution? Any ideas?

Edit: Should I just go with the standard DataTable / DataRow approach?

+3
source share
4 answers

In my opinion

Stored procedures are your friends for many reasons. I perform all the db operations in stored procedures in my projects and lock the application account on the SQL server to allow it to execute stored procedures (without direct access to any type of table). However, mixing updates / deletes in the same proc strikes me as bad practice (although I try to combine insert / update within the same procedure).

: ASP ASP.NET, -. +100 , .

"" , , . , , . db , .

ORM .

ORM, ASP ASP.NET MVC, . , ORM - , , .

+5

, . , , , .

, , - . . , .

+1

- , ?

, - . - -.

-, , : , .

, ORM ( - ) -. Dino Esposito - .

+1

. - -.

Scalability suffers a lot of time. Dependent logic may block CPU usage while processes are waiting for completion. Paralysis is important for a service-based architecture where databases are needed, mainly the read cache, to improve performance. Why beat one processor unit and block worker threads where it can be distributed?

I think that arguments should take these considerations into account without losing hair at any age.

0
source

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


All Articles