Emanuele,

That would work, but it involves actually writing code.  I'm looking for a
automagic solution.  With all of the innovations in .NET I was hoping that
there would be an easy way to represent many-to-many relationships in code.

Kind Regards,

John Lomnicki
Just Another .NET Guy

----- Original Message -----
From: "Emanuele DelBono" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 12, 2002 2:04 AM
Subject: Re: [ADVANCED-DOTNET] Many to Many Database Relationships in a Data
Object


You could build a custom data access layer using collections and
"single" objects.
For examples: if you have Customers and Products in N to N relation, you
could build these classes:


public class Customer
{
        private String name;
        private String surname;
        private Products customerProduts;
        //....
}

public class Customers : CollectionBase // Collection of customers
{
// Load, save, delete, etc...
}

public class Product
{
        private String code;
        private String description;
        // ...
        private Customers customersWhoBuyThisProduct;
}

public class Produts : CollectionBase   // Collection of products
{
// Load, save, delete, etc...
}

What do you think about it?

Emanuele

> -----Original Message-----
> From: Moderated discussion of advanced .NET topics. [mailto:ADVANCED-
> [EMAIL PROTECTED]] On Behalf Of Erick Thompson
> Sent: marted� 12 novembre 2002 0.57
> To: [EMAIL PROTECTED]
> Subject: Re: [ADVANCED-DOTNET] Many to Many Database Relationships in
a
> Data Object
>
> Datasets will support many-to-many relationships, and strongly typed
ones
> will do it even better. They will work, but I really want 'automagic'
> databinding for many to many relationships (does anyone know how to do
> this?). But if you don't need the databinding, take a look at
datasets.
>
> Erick
>
> ----- Original Message -----
> From: "John Lomnicki" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, November 11, 2002 2:01 PM
> Subject: [ADVANCED-DOTNET] Many to Many Database Relationships in a
Data
> Object
>
>
> I am looking for an easy way to create a data object that understands
a
> many
> to many relationship.  I have 15 many to many relationships in my
current
> database and am looking for a generic, repeatable, and easy way to
create
> data objects that understand the relationships between two tables with
a
> many to many relationship.  Any ideas?
>
>
> Kind Regards,
>
> John Lomnicki
> Just Another .NET Guy
>
> You can read messages from the Advanced DOTNET archive, unsubscribe
from
> Advanced DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.
>
> You can read messages from the Advanced DOTNET archive, unsubscribe
from
> Advanced DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the Advanced DOTNET archive, unsubscribe from
Advanced DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to