Business Logic/Layer Question - Concept

R

Ranginald

Hi,

I am confused about the business layer vs. the dal layer and I could
use some help.....

I. If the DAL layer has all the methods to work with the db with a
typed data sey (e.g. ShowProducts(), InsertProducts() ), then why does
the business layer need to wrap these methods with set/get?


II. Also, if the code for show products(), created in the DAL, is a
simpe INSERT SQL statement, then where does the validation go? I've
read that it's supposed to go in the business layer, so are you
supposed to do something like this:

businessLayerCode.cs

public static void ShowProductsUsingDALMethod ()
// call the DAL's ShowProducts Method
// that was defined with tableAdapter

public static void InsertProductsUsingDALMethd()
// write verification code such that you cannot insert a duplicate
product
// e.g. rule = "no two products can have the same name value in
tblProducts.Name"

if {
verification code is valid

InsertProducts()
}
else
//display message that you can't use this product name

==== is this where the verification code goes? It doesn't make sense
to me to make a call to the database (using a stored procedure) to
check that there isn't another product named "truck", and then make a
second call to insert the product "truck".

Thanks!
-David
 
G

Goofy

The way I do it is to let the DAL handle ALL data access, and in my business
layer are the rules which enable or not users to perform certain functions,
or access resources, my business layer also handles rules about cost
allocations etc.
 
M

Masudur

Hi

In addition, we can also implement the patter that is a must for some
business logics. For example Most of the manger classes are part of
Business Logic layer and a single tone class.
So if we are constricting a Data Access Layer for a Product.

All Insert Update Delete and Select stuff will go in DAL regardless any
security

Business Layer will contain the manager classes and security check. And
pattern implementation to meet the particular business problem
solution.

Thanks

Md. Masudur Rahman
www.kaz.com.bd
KAZ Software Ltd.
Software outsourcing made simple...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,044
Latest member
RonaldNen

Latest Threads

Top