|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
strong reference between objects in different assembliesi 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 You could use an interface.
Craig Buchanan wrote: Show quoteHide quote > 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 > > an interface that they both share?
currently, they both inherit the same base case (in a third assembly). Show quoteHide quote "Göran Andersson" <gu***@guffa.com> wrote in message news:e%23c%23kAWbGHA.3692@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 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: Show quoteHide quote > 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%23c%23kAWbGHA.3692@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 > > 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? Show quoteHide quote "Göran Andersson" <gu***@guffa.com> wrote in message news:etpc94sbGHA.1856@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%23c%23kAWbGHA.3692@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 >> 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: Show quoteHide quote > 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:etpc94sbGHA.1856@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%23c%23kAWbGHA.3692@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 >
hierachical related data in datatset
Binding to an enumeration Access rights for a web application to read a text file on a different server web reference to system.web.dll Multithreading Problem Converting VB Script Code to VB.NET 2005 SelectionChangeCommitted event evaluate or transform or ??? TCP send & Recieve How to display Printer Settings Dialogue? |
|||||||||||||||||||||||