Vs.Net project circular dependency

ThreeFiftyZ

Newcomer
Joined
Oct 29, 2003
Messages
4
Location
Philly 'burbs
Hey all,

I've broken our site into three seperate projects under one solution, per my bosses' request. One for presentation, business, and data layers.

The business project needs to reference the data project, fine and good there. BTW, the references are all Project References, not Web References.

Now, I've come to a point where I need the data layer to reference the business layer. Since the business layer already references the data layer, when I try to add a project reference from data -> business, I get a circular dependency error: "Adding this project as a reference would cause a circular dependency."

Why am I unable to add the reference? What is the issue with having a circular dependency???

Thanks,
Mark
 
The problem is what order should they be built in. If the business layer depends on the data layer then the data layer needs to be built first.
If the data layer depends on the business layer then the business layer needs to be built first.
If they depend on each other - problem.

What are the dependencies between the two layers and could this not be seperated out into a classlibrary of it's own?
 
Thanks for the quick reply.

In the business layer, I have a CBrowserDetection class, that uses BrowserHawk and basically just stores BH's values in it. In the data layer, we have a class to insert those values contained in CBrowserDetection. We'll call this class CBrowserDetectionDataHandler.

Instead of passing in each individual property to CBrowserDetectionDataHandler, I wanted to just pass in CBrowserDetection, and use the properties from the object itself.

We just wanted to keep the projects seperate for cleanliness, but if it doesn't work out that way, oh well, not much I can do.

I'm thinking about just one project for business/data layer, using different namespaces. That will definitely solve the problem, while maintaining a decent degree of cleanliness.

Thanks again for the help.
 
Keeping the layers seperate can definately have it's advantages - easier maintenance for one.
Could you not put the CBrowserDetection class into it's own DLL and just reference that from both the Data Layer and the business layer?
 
hehe, I could, but the boss has a mind-frame bent on each project compiling to one dll.

I did get him to "allow" one project for business/data, and different namespaces. Not as clean, but still seperate.

Thanks.
 
Back
Top