Hi all,
I have the following problem: I have 2 namespaces: NamespaceA in
ProjectA, and NamespaceB in ProjectB. NamespaceA contains class ClassA,
which contains a field of type NamespaceB.ClassB. And the other way
around: NamespaceB contains ClassB, containing a field of type
NamespaceA.ClassB. The compiler gives an error saying, that I am missing
the assembly references. So I add ProjectB to the references of
ProjectA, and after that try to add ProjectA to the references of
ProjectB, which Visual Studio does not enable me to do, saying, that
there would be a circular depency. How can I solve this problem?
Regards,
Krzysztof Kozlowski 3 19797
"Krzysztof Koz³owski" <ko*****@gazeta.pl> wrote in message
news:d6**********@inews.gazeta.pl... Hi all,
I have the following problem: I have 2 namespaces: NamespaceA in ProjectA, and NamespaceB in ProjectB. NamespaceA contains class ClassA, which contains a field of type NamespaceB.ClassB. And the other way around: NamespaceB contains ClassB, containing a field of type NamespaceA.ClassB. The compiler gives an error saying, that I am missing the assembly references. So I add ProjectB to the references of ProjectA, and after that try to add ProjectA to the references of ProjectB, which Visual Studio does not enable me to do, saying, that there would be a circular depency. How can I solve this problem?
Either change the design, or put both namespaces in the same assembly. If
such interdependency is really appropriate, then the namespaces belong in
the same assembly.
Options for redesign include:
Break out the common bits into a third assembly (possibly using interfaces)
or
Abstract the declared type of one of NamespaceA.ClassA.FieldA to be a
supertype or interface declared in AssemblyA.
Remember that namespaces and assemblies don't have to have to share
boundaries.
David
It is a generic software engineering problem it is not specific for C# and
surely it has a generic solution. You should implement a super class that
manages both... In your circumstance, you should add a new project to manage
both..
--
Thanks,
Yunus Emre ALPÖZEN
BSc, MCAD.NET
"Krzysztof Koz³owski" <ko*****@gazeta.pl> wrote in message
news:d6**********@inews.gazeta.pl... Hi all,
I have the following problem: I have 2 namespaces: NamespaceA in ProjectA, and NamespaceB in ProjectB. NamespaceA contains class ClassA, which contains a field of type NamespaceB.ClassB. And the other way around: NamespaceB contains ClassB, containing a field of type NamespaceA.ClassB. The compiler gives an error saying, that I am missing the assembly references. So I add ProjectB to the references of ProjectA, and after that try to add ProjectA to the references of ProjectB, which Visual Studio does not enable me to do, saying, that there would be a circular depency. How can I solve this problem?
Regards,
Krzysztof Kozlowski
I blogged a solution to this problem not long ago.
See: http://blogs.msdn.com/nickmalik/arch...18/398601.aspx
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Krzysztof Koz³owski" <ko*****@gazeta.pl> wrote in message
news:d6**********@inews.gazeta.pl... Hi all,
I have the following problem: I have 2 namespaces: NamespaceA in ProjectA, and NamespaceB in ProjectB. NamespaceA contains class ClassA, which contains a field of type NamespaceB.ClassB. And the other way around: NamespaceB contains ClassB, containing a field of type NamespaceA.ClassB. The compiler gives an error saying, that I am missing the assembly references. So I add ProjectB to the references of ProjectA, and after that try to add ProjectA to the references of ProjectB, which Visual Studio does not enable me to do, saying, that there would be a circular depency. How can I solve this problem?
Regards,
Krzysztof Kozlowski This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Evelyne |
last post by:
On a server W2K, IIS5, I have many messages from ASP :
cirdular dependency between types/modules. Which can be
the origin of the problem?
Example :
Event Type: Warning
Event Source: Active...
|
by: Henry Miller |
last post by:
I have the following code (much simplified for this post). Note that
SessionKey uses DataAccess, and DataAccess requires SessionKey in it's
constructor.
Public Class SessionKey
Public...
|
by: ernesto basc?n pantoja |
last post by:
Hi everybody:
I'm implementing a general C++ framework and I have a basic question
about circular dependencies:
I am creating a base class Object, my Object class has a method
defined as:...
|
by: ro86 |
last post by:
Hello everyone!
I am a newbie to C++ (~1 Week experience) and I have a few months of
experience with object-oriented languages (Objective-C). I am
currently working just for fun on a particle...
|
by: Henke |
last post by:
I have this scenario.
public class A
{
public int numbers;
public class A()
{
}
|
by: Rimma Meital via .NET 247 |
last post by:
(Type your message here)
--------------------------------
From: Rimma Meital
I have 2 DLLs (Class Libraries). Both defines single-ton objects - logger object (writes to logger) and...
|
by: Rob Clark |
last post by:
Hi,
I have an issue which is the ordinary and always recurring circular
dependency - but I do not know how to resolve it :-( The usual forward
declaration does not help...
I have a client...
|
by: barias |
last post by:
Although circular dependencies are something developers should normally
avoid, unfortunately they are very easy to create accidentally between
classes in a VS project (i.e. circular compile-time...
|
by: donnyma |
last post by:
I have a problem that looks like it has not been discussed before in
these groups.
I have a simple SQLAgent job that runs sp_who (could be anything, but
let's just say sp_who for this example). ...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |