Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 27th, 2008, 02:29 PM
Registered User
 
Join Date: May 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Many-to-Many relationships and Business Objects.

Hi, I am building my Business Objects and as I am new on it I am tryin to figure out what are the best practices on turning a table that manages a many-to-many relationship into a Business Object. If someone has any hint for me, I appreciate.

Thanks.

 
Old May 27th, 2008, 04:46 PM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

I'd recommend you try and find a Business Objects forum, as this one is devoted to C#.

/- Sam Judson : Wrox Technical Editor -/
 
Old May 28th, 2008, 03:14 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

The design pattern that deals with that structure is called the 'mediator pattern'. Suggest you search for examples online.

--

Joe (Microsoft MVP - XML)
 
Old May 28th, 2008, 06:12 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

OK, I feel stupid now - I thought you where referring to Business Objects - the reporting tool.

In most many-to-many relationships I have come across there is a link table joining the two tables, so that would mean you would model the link table as well.

If you need more specific advice then you'll have to detail examples of your tables etc.

/- Sam Judson : Wrox Technical Editor -/
 
Old May 28th, 2008, 07:31 AM
Registered User
 
Join Date: May 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the replys. The structure of my tables is something like this:

Work
(PK) idWork
Description
Code

DocumentType
(PK) idDocumentType
Description

And, as this tables must have a many-to-many relationship, the link table:

WorkDocumentType
(PK) idWorkDocumentType
(FK) idWork
(FK) idDocumentType
Code

The reason I have to do it, is because that, for every new Work, the Code fields of DocumentType will be different. The problem I am facing is that a I don't know the correct way to create the BOs for those tables.

And I am tryin to understand the Mediator pattern and it seems this is what I need, but if anyone else have any other way possible, I appreciate.

Thanks again.


 
Old May 28th, 2008, 07:38 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You need to structure the business objects such that they make sense for your business model. If you work from the prospective of "Work" then the "Work" class would have a property containing a list of "Document"s.

You don't necessarily need to model the junction table in your business object library because there is very little meaning to it. It simply serves to join together related instances of "Work" and "Document".

-Peter
compiledthoughts.com
 
Old May 28th, 2008, 09:44 PM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

Keep in mind that the point of BOs is to let you remove highly specific application code from specific webpages as you have to do when using Data Sources. BOs free you from tying an implementation to each and every page where you want to use it making it easier to use database data in your application and to maintain the application when you decide to make changes. You now do it in one business object instead of many pages, but the BO is still an application component. The tables are still set up in your database, and the BO simply "automates" features of how you use that data in your application. I'm just starting to look at them myself and find them very exciting.

-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.





Similar Threads
Thread Thread Starter Forum Replies Last Post
business object relationships thenoseknows ASP.NET 1.x and 2.0 Application Design 2 July 16th, 2007 03:02 PM
Visual Basic .Net Business Objects Source Download LMDSD Forum and Wrox.com Feedback 5 May 20th, 2005 04:24 PM
VB.NET Business Objects AlfredoDS Wrox Book Feedback 1 July 7th, 2003 10:37 AM
VB.NET Business Objects throughput Wrox Book Feedback 1 June 26th, 2003 06:16 AM
Visual Basic .NET Business Objects ofergold All Other Wrox Books 2 June 6th, 2003 08:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.