View Full Version : Business Layer Question

06-06-2012, 07:21 PM
I am trying to convince a colleague that we should move our app's business logic that currently resides in stored procedures to Csharp/VB code behind for the upcoming rewrite of one of our ancient ASP classic applications.

Would you please share your knowledge of advantages and disadvantages to storing business logic in the code behind instead of stored procedures?

The main advantages I see to using the code behind as the business logic layer are (in no particular order):

1) ease of debugging business layer logic - this can be done at compile time
2) ease of maintainability (touches on advantage 1)
3) re-usability - encapsulation of classes that can easily be reused.

06-06-2012, 08:49 PM
your application should be broken into three tiers: Database, Business, GUI. All inputs from the GUI should then be run through the business layer- think of it as validation. Then the cleaned data should be transported to the database via the database layer.

housing business logic in stored procs (or any SQL) limits what you can do. SQL is not as powerful as the .net framework- it's intention was not to be a validate/clean... it's intention was to be a repository for your information.

06-07-2012, 08:36 PM
Validation is being done at both levels we will be migrating an app from ASP classic using VB script to ASP.net using VB.

Multiple stored procs have business logic in them that I want to move to the code behind in ASP.net. Most logic resides in the ASP classic pages in vb script.

There is a DTS package that runs a stored proc with a lot of logic in it as well. Determining payments and what not for customers.