Re: Circular dependency
- From: nyhetsgrupper@xxxxxxxxx
- Date: 1 Oct 2006 01:23:55 -0700
Thank you Aaric. You aproach seems OK, I think I will go for a similar
solution. You are probable rigth about this not breaking the oo model.
I am not consider my self proficient in the OO principles either.
Aaric wrote:
Sure, my business objects only contain datatypes (private fields and their
public accessors) and no logic except for one public method that takes
IDataReader and populates the fields with the data from the datareader,
sometimes I have heard this refered to as data transfer objects (DTO). The
purpose is to be a light weight object for transfering data between layers.
So, the business logic layer gets a request for an object. It then
instantiates the object and passes it down to the data access layer. The data
access layer populates the object by calling the public method and passing in
an IDataReader. Then the data access layer returns the object to the business
logic layer which applies any necessary logic and then returns it to the UI
which initiated the request.
Now, whether or not this breaks the OO model I am not really sure. I would
not think so, but I also would not consider my self proficient in the OO
principles. What do you think or if any one else can provide insight on this
I would gladly welcome the information.
Thanks,
Aaric
"nyhetsgrupper@xxxxxxxxx" wrote:
Thank you all for taking the time to answer. Can you explain in greater
detail what you mean Aaric? Which interfaces does each of your 3
projects expose? Does the Buisness object project keep datatypes only?
No logic? Doesn't that break the OO model to place the logic for an
object outside the object itself?
Aaric wrote:
I favor the option of separate projects as well. I typically have 3 separate
projects: 1)Data Access Layer, 2)Business Logic Layer, and 3)Business
Objects. Then both the Data Access Layer and the Business Logic Layer
reference the Business Objects project.
"nyhetsgrupper@xxxxxxxxx" wrote:
I'm trying to build a .NET application (C#) which I want to seperate
into the classic UI, Business Logic and Data Access layers.
I expected to seperate each layer into different projects and reference
each as required, when I try to do this I run into circular referencing
problems between the projects because the Data Access project
references the Business object project and vice versa.
The examples I have read from varous sources involve passing business
objects to the Data Access Layer to get them populated, normally this
happens in the constructor of the Data Access Layer - the Business
object creates a Data Access Object and passes itself in (as "this").
This is OK but in the examples the Data Access objects and the Business
objects reside in the same project so don't have the circular
referencing problems that I have.
I would be grateful for some help and examples.
.
- References:
- Circular dependency
- From: nyhetsgrupper
- Re: Circular dependency
- From: nyhetsgrupper
- Re: Circular dependency
- From: Aaric
- Circular dependency
- Prev by Date: Re: I need help with something
- Next by Date: ToolStripStatusLabel too long
- Previous by thread: Re: Circular dependency
- Next by thread: How to dynamically display entries made into a growing log file
- Index(es):
Relevant Pages
|
Loading