473,387 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

strong reference between objects in different assemblies

i have two classes: User and Group. Each is in their own assembly. The
User class has Groups collection and the Group has a Users collection. I
would like to strongly-type these collections, but i can't seem to avoid the
circular reference between projects. is there a way around this?

Thanks,

Craig Buchanan
May 1 '06 #1
6 1173
You could use an interface.

Craig Buchanan wrote:
i have two classes: User and Group. Each is in their own assembly. The
User class has Groups collection and the Group has a Users collection. I
would like to strongly-type these collections, but i can't seem to avoid the
circular reference between projects. is there a way around this?

Thanks,

Craig Buchanan

May 1 '06 #2
an interface that they both share?

currently, they both inherit the same base case (in a third assembly).

"Göran Andersson" <gu***@guffa.com> wrote in message
news:e%******************@TK2MSFTNGP05.phx.gbl...
You could use an interface.

Craig Buchanan wrote:
i have two classes: User and Group. Each is in their own assembly. The
User class has Groups collection and the Group has a Users collection.
I would like to strongly-type these collections, but i can't seem to
avoid the circular reference between projects. is there a way around
this?

Thanks,

Craig Buchanan

May 1 '06 #3
No, you only need an interface for one class. Then the other class can
use the interface for handling objects of the first class, and doesn't
even need to know that the first class exists.

Craig Buchanan wrote:
an interface that they both share?

currently, they both inherit the same base case (in a third assembly).

"Göran Andersson" <gu***@guffa.com> wrote in message
news:e%******************@TK2MSFTNGP05.phx.gbl...
You could use an interface.

Craig Buchanan wrote:
i have two classes: User and Group. Each is in their own assembly. The
User class has Groups collection and the Group has a Users collection.
I would like to strongly-type these collections, but i can't seem to
avoid the circular reference between projects. is there a way around
this?

Thanks,

Craig Buchanan


May 3 '06 #4
If I keep the interface in the same assembly as the class, i haven't solved
the problem. for example:

MyFramework.Plugins.UserPlugin assembly contains:
User class
IUser interface

MyFramework.Plugins.GroupPlugin assembly contains:
Group class
IGroup interface

The GroupPlugin assembly can have a reference to the UserPlugin or
UserPlugin assembly can have a reference to the GroupPlugin, but not both at
the same time.

My goal is to create a plugin framework, where a given framework can have a
strong reference to a class in another plugin assembly. i want to have the
option to have interdependencies as well (as above).

I may have to have both of these classes in one assembly.

thoughts?

"Göran Andersson" <gu***@guffa.com> wrote in message
news:et**************@TK2MSFTNGP03.phx.gbl...
No, you only need an interface for one class. Then the other class can use
the interface for handling objects of the first class, and doesn't even
need to know that the first class exists.

Craig Buchanan wrote:
an interface that they both share?

currently, they both inherit the same base case (in a third assembly).

"Göran Andersson" <gu***@guffa.com> wrote in message
news:e%******************@TK2MSFTNGP05.phx.gbl...
You could use an interface.

Craig Buchanan wrote:
i have two classes: User and Group. Each is in their own assembly.
The User class has Groups collection and the Group has a Users
collection. I would like to strongly-type these collections, but i
can't seem to avoid the circular reference between projects. is there
a way around this?

Thanks,

Craig Buchanan


May 3 '06 #5
Put the interface for the class in the other assembly:

1:
IUser interface
Group class

2:
User class implements IUser

Assembly 2 references assembly 1. The Group class uses IUser to
reference user objects, and the User class can use Group objects.

Or the other way around if you like. Or you can put interfaces for both
classes in one of the assemblies. Or but the interfaces in a separate
assembly.

Craig Buchanan wrote:
If I keep the interface in the same assembly as the class, i haven't solved
the problem. for example:

MyFramework.Plugins.UserPlugin assembly contains:
User class
IUser interface

MyFramework.Plugins.GroupPlugin assembly contains:
Group class
IGroup interface

The GroupPlugin assembly can have a reference to the UserPlugin or
UserPlugin assembly can have a reference to the GroupPlugin, but not both at
the same time.

My goal is to create a plugin framework, where a given framework can have a
strong reference to a class in another plugin assembly. i want to have the
option to have interdependencies as well (as above).

I may have to have both of these classes in one assembly.

thoughts?

"Göran Andersson" <gu***@guffa.com> wrote in message
news:et**************@TK2MSFTNGP03.phx.gbl...
No, you only need an interface for one class. Then the other class can use
the interface for handling objects of the first class, and doesn't even
need to know that the first class exists.

Craig Buchanan wrote:
an interface that they both share?

currently, they both inherit the same base case (in a third assembly).

"Göran Andersson" <gu***@guffa.com> wrote in message
news:e%******************@TK2MSFTNGP05.phx.gbl...
You could use an interface.

Craig Buchanan wrote:
> i have two classes: User and Group. Each is in their own assembly.
> The User class has Groups collection and the Group has a Users
> collection. I would like to strongly-type these collections, but i
> can't seem to avoid the circular reference between projects. is there
> a way around this?
>
> Thanks,
>
> Craig Buchanan

May 3 '06 #6
Thanks, I will give this approach a try.

"Göran Andersson" <gu***@guffa.com> wrote in message
news:eS**************@TK2MSFTNGP05.phx.gbl...
Put the interface for the class in the other assembly:

1:
IUser interface
Group class

2:
User class implements IUser

Assembly 2 references assembly 1. The Group class uses IUser to reference
user objects, and the User class can use Group objects.

Or the other way around if you like. Or you can put interfaces for both
classes in one of the assemblies. Or but the interfaces in a separate
assembly.

Craig Buchanan wrote:
If I keep the interface in the same assembly as the class, i haven't
solved the problem. for example:

MyFramework.Plugins.UserPlugin assembly contains:
User class
IUser interface

MyFramework.Plugins.GroupPlugin assembly contains:
Group class
IGroup interface

The GroupPlugin assembly can have a reference to the UserPlugin or
UserPlugin assembly can have a reference to the GroupPlugin, but not both
at the same time.

My goal is to create a plugin framework, where a given framework can have
a strong reference to a class in another plugin assembly. i want to have
the option to have interdependencies as well (as above).

I may have to have both of these classes in one assembly.

thoughts?

"Göran Andersson" <gu***@guffa.com> wrote in message
news:et**************@TK2MSFTNGP03.phx.gbl...
No, you only need an interface for one class. Then the other class can
use the interface for handling objects of the first class, and doesn't
even need to know that the first class exists.

Craig Buchanan wrote:
an interface that they both share?

currently, they both inherit the same base case (in a third assembly).

"Göran Andersson" <gu***@guffa.com> wrote in message
news:e%******************@TK2MSFTNGP05.phx.gbl...
> You could use an interface.
>
> Craig Buchanan wrote:
>> i have two classes: User and Group. Each is in their own assembly.
>> The User class has Groups collection and the Group has a Users
>> collection. I would like to strongly-type these collections, but i
>> can't seem to avoid the circular reference between projects. is
>> there a way around this?
>>
>> Thanks,
>>
>> Craig Buchanan

May 4 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ted | last post by:
What are the negatives to strongly naming assemblies? Why wouldn't we want to strongly name all assemblies that we ship as part of our products? Thanks Ted
4
by: Derrick | last post by:
Long story short: I've been working on a project which includes both designtime and runtime components, for both the PC and Pocket PC. While testing, I've been having problems with Visual Studio...
10
by: Tony Jones | last post by:
Can anyone think of a reason why a 3rd party vendor writing .NET components would NOT strong name their assemblies? What harm does adding a strong-name to assembly present - I would think none...
2
by: Thomas W. Brown | last post by:
If I am using the CSharpCodeProvider to dynamically compile an in-memory assembly from some C# source, do I need to worry about signing this assembly if I'm doing the compilation, instantiation,...
3
by: Richard Lewis Haggard | last post by:
We are having a lot of trouble with problems relating to failures relating to 'The located assembly's manifest definition with name 'xxx' does not match the assembly reference" but none of us here...
0
by: John Liu | last post by:
Recently I had to do some really nasty work (I consider any IL work nasty) to get a set of (not strong named) 3rd party assemblies to compile with our solution (which is strong named). ...
7
by: Alan T | last post by:
I have create a class library and add it to the reference list in one of the projects. However, when I compile the project and got the error: Assembly generation failed -- Referenced assembly...
1
by: Tom | last post by:
My unsigned DLL works in my project that references it as long as I set Copy Local = true. Now I have signed the DLL with the sn.exe generated keys but have not yet moved the DLL into the GAC. ...
6
by: raylopez99 | last post by:
Anybody use Strong Name Signing? I think this is used by default for Resource files, which is one reason perhaps I can't get my resource files to work (somehow the public key is messed up, perhaps...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.