473,513 Members | 2,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Many to Many relationship between objects - The best way to implement

Hi everyone,

What is the best way to implement many-to-many relationship between objects?
Any examples or links are welcome!

Thank you,
Sasha
Nov 15 '05 #1
4 2850
Sasha,

The same way you would with a database, create an intermediate object that
relates the two objects.

Dan
"Sasha" <no@no.com> wrote in message
news:ei**************@TK2MSFTNGP09.phx.gbl...
Hi everyone,

What is the best way to implement many-to-many relationship between objects? Any examples or links are welcome!

Thank you,
Sasha

Nov 15 '05 #2
Thank you for the answer Solex,

But who would be responsible for creating the link object, or destroying it?
I am trying to keep my model loosly coupled...
"solex" <so***@nowhere.com> wrote in message
news:ut*************@TK2MSFTNGP09.phx.gbl...
Sasha,

The same way you would with a database, create an intermediate object that
relates the two objects.

Dan
"Sasha" <no@no.com> wrote in message
news:ei**************@TK2MSFTNGP09.phx.gbl...
Hi everyone,

What is the best way to implement many-to-many relationship between

objects?
Any examples or links are welcome!

Thank you,
Sasha


Nov 15 '05 #3
That is a good question. In my case I have Parties that can be related to
other parties via a PartyRelation object. I made a decision to make the
relationships directional, so that one party actually owns the relationship.

In my case it is up to the application to create the link or destory it.

Dan

"Sasha" <no@no.com> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
Thank you for the answer Solex,

But who would be responsible for creating the link object, or destroying it? I am trying to keep my model loosly coupled...
"solex" <so***@nowhere.com> wrote in message
news:ut*************@TK2MSFTNGP09.phx.gbl...
Sasha,

The same way you would with a database, create an intermediate object that relates the two objects.

Dan
"Sasha" <no@no.com> wrote in message
news:ei**************@TK2MSFTNGP09.phx.gbl...
Hi everyone,

What is the best way to implement many-to-many relationship between

objects?
Any examples or links are welcome!

Thank you,
Sasha



Nov 15 '05 #4
Sasha,
In addition to Solex's suggestion.

Simply have each object own (contain) a collection of the other object. This
collection could be any .NET collection, such as: an array, ArrayList,
HashTable, or a collection derived from CollectionBase or DictionaryBase.

If you are coming from a database, then the Association Table Mapping
Pattern may be more helpful.

http://www.martinfowler.com/eaaCatal...leMapping.html

Hope this helps
Jay

"Sasha" <no@no.com> wrote in message
news:ei**************@TK2MSFTNGP09.phx.gbl...
Hi everyone,

What is the best way to implement many-to-many relationship between objects? Any examples or links are welcome!

Thank you,
Sasha

Nov 15 '05 #5

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

Similar topics

1
2081
by: Mark Hargreaves | last post by:
Hopefully someone can help. I have two tables, namely master and postings: Fields include the following: master: staffno - int (11) primary key forename - varchar (20) surname - varchar...
3
1992
by: Mikey | last post by:
Hi all. In the process of trying to figure this thing out, I've been doing the old "stand around in the store and read as much as possible before you look like a derelict" thing. This time, with...
3
2798
by: Rich | last post by:
I notice that lots of the GDI+ objects implement IDisposable: SolidBrush, FontFamily, Font, etc. If I don't explicitly call Dispose() on these guys after I'm done with them, what is the...
6
5192
by: Anon Email | last post by:
Hi everyone, I've written some code that contains a class, and I want to track the number of instances of this class that have been created, eg.: "This is number xx object created." What is the...
1
1671
by: ning | last post by:
It's easy to present "One - Many" relationship in XML, but how to present "Many - Many" relationship in XML?
2
2127
by: Todd D. Levy | last post by:
I have a primary table (containing basic contact information) and a number of subsidiary tables (containing various additional information) for employees. Most of the subsidiary tables have a...
2
4704
by: Ronald S. Cook | last post by:
In my ASP.NET app, I have a few pages that I want to be public (i.e. accessible by everyone) and the rest private (user has to be signed in). In the examples I've seen, the public files have been...
2
1350
by: Gav | last post by:
Hi All, I'm trying to create a table in a sql database. When I run ExecuteNonQuery(); I get an error "Objects must implement IConvertible". I put the same statement in a textbox, after...
2
2209
by: The Frog | last post by:
Hello everyone, I am trying to find way of writing an SQL query that can produce missing record combinations across a many to many type setup in Access. The three tables used are as follows:...
1
1703
by: johnnyD | last post by:
How would I traverse through a namespace and determine all the object types that implement an interface. For instance in the namespace "Microsoft.SqlServer.Management.Smo" Namespace I want to...
0
7379
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
7521
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5682
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5084
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1591
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.