Solved

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

Posted on 2010-11-15
5
279 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…

827 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