CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML





Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.visual_studio_2005 Tags:
Item Type: NewsGroup Date Entered: 12/4/2006 2:53:40 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 4 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
2 Items, 1 Pages 1 |< << Go >> >|
tother
Asp.Net User
Build a solution12/4/2006 2:53:40 PM

0/0

I am trying to build a solution that has two projects,but the projects refer reciprocally!!Can you tell me how to add reference,when I add a reference for a project to  another,then the VS.net 2005 alert me"This dependency cannot be added because it will create a circular dependency"!!Can you tell me to build that solution!Thanks!Embarrassed

Nice to Meet You........
DMW
Asp.Net User
Re: Build a solution12/4/2006 3:34:33 PM

0/0

You will need to restructure the code so that you remove the circular dependency. In some cases this will involve adding a third assembly, and possibly involve adding additional types.

Consider a simple example.

Assume that in assembly ONE you had the following class

public class A
{
  void Foo( B theB )
  {
  }
}

and in assembly TWO you had

public class B
{
  A[] anArrayOfAs;
}

Clearly this makes for a circular dependency.

One solution to this problem is to introduce a new interface type in a third assembly, as follows:

Assembly ONE has

public class A : ITheAInterface
{
  void Foo( ITheBInterface it )
  {
  }
}

In assembly TWO you might have 

public class B : ITheBInterface
{
  ITheAInterface[] anArray;
}

And in assembly THREE you might have

public interface ITheBInterface { ... }
public interface ITheAInterface { ... }

Note that assembly ONE is dependent only on assembly THREE. Similarly, assembly TWO is only dependent on assembly THREE.

You might be thinking that this is simply too easy, and it doesn't tackle real problems such as

(in assembly ONE)

public class A
{
  void Foo()
  {
    B theB = new B();
  }
}

and in assembly TWO

public class C
{
  void Bar()
  {
    A theA = new A();
  }
}

And you'd be right. It would appear that the third assembly option might not help because you always need the new method to create objects. Well, there's two things to consider here. The first is simply "is the code well structured?" (and to be honest, it wouldn't appear to be). The second is "if we have this level of coupling, should the components all be in the same assembly?"

Given that A, B and C seem to be unable to operate independently of each other, in this case there would be a strong argument for placing them all in one assembly.


Dave
2 Items, 1 Pages 1 |< << Go >> >|



Search This Site:


Meet Our Sponsors:



Other Resources:

Trying to build a multicolumn recordset display - macromedia ... Trying to build a multicolumn recordset display, > ROOT > NEWSGROUP > Adobe-Macromedia Forums > macromedia.dreamweaver. ... Author, "PHP Solutions" (friends of ...
NuVox :: Build :: Solutions Telecommunications provider offering integrated local and long distance telephone services and high-speed broadband ... help us build a solution that is ...
Solution Builder - QuickBooks Enterprise Solutions ... business management solutions from QuickBooks Enterprise Solutions help automate ... Home > Solution Builder. Build a Custom Solution. Email. Print. Feedback ...
Build a Solution | Logicworks Business Solutions. White Papers. Answers by Logicworks. Performance and Scalability ... Make a Service Request. LogicOps. 866-FOR-LOGIC. Build a Solution ...
The SCO Group, Inc. | Solution_builder SCO Solution Builder. The Power of UNIX® Contact SCO. Legal. Privacy. Download. Product Registration. Documentation. Legal Filings. Knowledge Center ...
Adobe - Adobe InDesign CS3 Server: Build a solution If you have successfully developed a solution that you plan to resell, inform ... Solutions info. From desktop to server. Common solutions. Build vs. buy a solution ...
Build a Car, Truck or Van : Build and Price Your Own Car Online Your complete satisfaction is important to us. We have the facilities, representatives, technicians, tools and up-to-date information to ... Fuel Solutions ...
Document imaging scanners and document management software solutions. Document imaging scanners and document management software solutions. ... Home > Products > Document Imaging > Build A Solution ...
2007 Microsoft Office system Solution Drive Learn more about the 2007 Microsoft Office System Solution Drive ... Build and market your 2007 Microsoft Office system solutions today! ...
NuVox :: Our Solutions :: Network Solutions If your business operates across multiple locations, NuVox can build a solution that fits! Our easy, cost-effective networking solutions keep you connected.



 
All Times Are GMT