Click here to Skip to main content
15,899,314 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

There is always a debate over the topic - "Whether to put the business logic in Stored Procedure or Not?". If we decide not to use the ORM Tool and not to put the Business Logic in Stored Procedure then where would we put the Business Logic?

In my previous applications I have always preferred putting all of the Business Logic in Stored Procedures only. Then from .NET code I call these Stored Procedures using Data Access Application Blocks. SQLHelper etc. But this can not be the scenario all the time. So I did some googling but ended up in confusion.......

Any suggestionss...?

Regards,
Pravin
Posted

1 solution

IMHO, there's a reason why you have a Data Access Layer, and a Business Logic Layer. If you have a small application that does not have much business logic, then I guess you can at put it on your SP. But when you have a complex app, I suggest you create a BLL for that. Reason for it is maintainability. What if there are pending tasks to make some data related fix/enhancement to them? Chances are, you might end up modifying the business logic part of the SP every time this happens.
 
Share this answer
 
Comments
Pravin Patil, Mumbai 28-Jul-11 5:17am    
So, you mean that we should limit the Stored Procedure to fetching the data only and whatever logic we have to apply that should go in BLL i.e. .NET Code.
walterhevedeich 28-Jul-11 5:34am    
Not exactly. What I am trying to point out is that business logic should, as much as possible, be put on the the BLL. The SP would not be limited to fetching data only as you also need to do data validation, and this is different from business rules validation, which is what you will put on the BLL.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900