James,
> I would like to hear what you consider a 'GOOD Design!'
> approach for many to many relationships and Application code.
My point was that I've seen implementation in which linking tables were
directly translated to entity classes. That was wat I considered 'bad'.
Consider f.i. a relational-database schema in which a linking table is used
to implement the many-to-many relationship between orders and products:
Product (ProductID, ...)
Order (OrderID, ...)
Order_Product (OrderID, ProductID)
Application-layer 'translation':
class Product { int ID; /* ... */ }
class Order { int ID; /* ... */ }
class Order_Product { int OrderID; int ProductID; }
While I think this better:
class Product { int ID; /* ... */ }
class Order { int ID; OrderLineCollection Lines; /* ... */ }
class OrderLine { int ProductID; /* ... */ }
class OrderLineCollection { IList Lines; }
And there are ofcourse other issues too. For example, while I'd like to be
able to navigate from an order to its related products, I typically don't
want to be able to edit these products through this order.
Regards,
Stefan
===================================
This list is hosted by DevelopMentor� http://www.develop.com
Some .NET courses you may be interested in:
NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls
View archives and manage your subscription(s) at http://discuss.develop.com