Click here to Skip to main content
15,886,798 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Please help me. I am working on an application with three layers (projects in VS 2008) - DAL, BLL and UI. The DAL has two classes for my table, Customers. The Customer Data Access Class performs CRUD against the database, and populates the Customer Data Object Class which consists only of properties with get/set and Constructors for initializing it. I created the Data Object to use it to pass query results back to the BLL. Now both of these classes are in the DAL project.

The BLL (project) references the DAL. I have these question:

1. How do i create a BLL class for the Customer object that implements business logic for Insterts, Updates and Deletes as well as check the values of the fields to conform to business requirements?

2. The customer BLL class; must it also create all the properties for the Customer objects, as well as the Insert, Update and Delete methods as created in the Customer Data Access Layer before being able to enforce business rules?

3. How does the BLL pull out the state of the Customer Data Objectt so that the UI can consume it, such as when the UI desires to query the database? I do not want the UI to circumvent the BLL, as i want to place authorization rules there, among other things.

Please help me, Some sample code will be greatly appreciated, as i have never worked on this type of layered architecture.
Thank you.

Melton
Posted

1 solution

Sounds like you read a magazine article but don't really understand what you're doing.

1 - you write code to call the DAL and check the return values.

2 - I don't know. I would expect that the Customer class would have a constructor that creates a new object and stores it in the DB. But, your business needs are up to you

3 - The UI can call the DAL directly if all it wants is to get back a collection of objects from the DB.

coommark wrote:
as i have never worked on this type of layered architecture.


Well, it's really common sense. Make sure the layers do not rely on each other overly, and keep all data access in the DAL, and all business logic in the BLL.
 
Share this answer
 

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