Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-11-15
5
Medium Priority
?
294 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 1000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

783 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