Solved

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

Posted on 2010-11-15
5
276 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 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

10 Experts available now in Live!

Get 1:1 Help Now