473,396 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Business Logic/Layer Question - Concept

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

Nov 27 '06 #1
2 1988
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.

"Ranginald" <da*******@gmail.comwrote in message
news:11**********************@45g2000cws.googlegro ups.com...
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

Nov 27 '06 #2
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...

Nov 27 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Simon Harvey | last post by:
Hello Chaps, Me and a collegue have been talking about where the best place to put business logic is. I think that the best place is where Microsoft suggest - in a seperate business logic...
25
by: Stuart Hilditch | last post by:
Hi all, I am hoping that someone with some experience developing nTier apps can give me some advice here. I am writing an nTier web app that began with a Data Access Layer (DAL), Business...
9
by: Hasan O. Zavalsiz | last post by:
Hi , i am trying to figure out which approach is better to use . let me explain the scenario. i am using the "Nortwind" database . in this database i have "Customers " table .The following is the...
6
by: Green Taylor | last post by:
Hi Gurus, I am still a new developer, learning things everyday, need some concept advices (Windows App.). I have learned that we should keep our code seperate from user interface layer. ...
7
by: Rob R. Ainscough | last post by:
I understand and implement the concept (as best I can), BUT what I would like to know -- how is it possible to completely remove the UI from business logic? "UI references business logic, but...
16
by: MS newsgroup | last post by:
I don't have clear reasons why we need business logic layer and data logic layer instead of having only data logic layer. Are there any good reasons for that?
25
by: Penelope Dramas | last post by:
Hello, I'm in a front of very serious .net redesign/rewrite of an old VB6 application. I had been asked to make it .NET 2.0 and would like to ask couple of questions regarding data access as...
2
by: Chris Zopers | last post by:
Hello, I would like to know what's the best way to implement a business logic layer between my user interface and my database. I would say I'd make a dll-project for the business logic layer...
9
by: SAL | last post by:
Hello, I have a Dataset that I have table adapters in I designed using the designer (DataLayer). I have a business logic layer that immulates the DataLayer which may/may not have additional logic...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.