Solved

How to pass the object instead of individual parameters to Data access layer?

Posted on 2010-11-15
5
277 Views
Last Modified: 2012-05-10
I have Business Objects layer having all the BOs. And I have data access layer. Now I want to pass the object (instead of individula parameters) to data access layer. I do not have the reference of Entity in Data access layer. How to pass the objects instead of parmeters? Can anyone explain me with small exapmle?
0
Comment
Question by:GouthamAnand
  • 2
  • 2
5 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 34138288
If you DAL won't recognise you're business object (presumably because you don't reference the BLL dll in your DAL) then you don't have much option unless you alter your DAL.
0
 
LVL 12

Expert Comment

by:jagssidurala
ID: 34138359
Create a properties class where define all the related properties.

and assign all the values to this object. send this object to the DAL class.

For ex: Properties class is EmployeeListDTO, where i am having EmployeeId, EmployeeName, Designation properties.

import properties namespace in DAL,BAL and UI.
in BAL or UI ,


assign variables like below

EmployeeDAL objEmployeeDAL = new EmployeeDAL();
EmployeeListDTO objemployeelistDTO = new EmployeeListDTO();
objemployeelistDTO.EmployeeId = 1;
objemployeelistDTO.EmployeeName = "jagadeesh";
objemployeelistDTO.Designation = "SSE";

objEmployeeDAL.InsertEmployee(objemployeelistDTO);

thats it

you should define this "InsertEmployee" method in DAL.
0
 

Author Comment

by:GouthamAnand
ID: 34138506
If I refer BO layer in DAL then it leads circular reference. And also I am refering the upper layer (BO) in lower layer (DAL) which I don't want to do.
Now is there any way with interfaces? If Yes, How?
0
 
LVL 12

Accepted Solution

by:
jagssidurala earned 500 total points
ID: 34138570
You need  to create Properties Class separatly not in BAL.

The flow will like this.

1) UI

2) BAL Class library

3) DAL Class library

4) Properties Class Library

Step1: Add Properties DLL in DAL,BAL and UI
Step2: Add DAL dll in BAL
Step3 : Add BAL dll in UI

Thats it


0
 

Author Closing Comment

by:GouthamAnand
ID: 34159123
Thank you.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now