Many to Many relationships


Author
Message
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The only two events on the BusinessBindingSource are ListChanged and Disposed, and the only event on the BusinessLayerLinkManager is Disposed, so I'm not sure what events the intellisense window is showing. 

As for the best place to put your filter code... you can put it anywhere after you fill the Table1 business object.  When you fill a business object, it wipes out the filter, it will generally wipe out the filter, so as long as you don't set the filter until the BO has been filled, you'll be fine.

Mark Dowlearn
Mark Dowlearn
StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)
Group: Forum Members
Posts: 34, Visits: 9.9K
OK - I think I see part of what was going on.  It looks like I had coded a "FillAllRecords()" in the ParentFormLoading() method on the component, and it appears that this was overriding any fill() that I did in the business object locally on the form (which is why all the records were showing up all the time).

So I'm now able to filter the Contacs and AddressContact table based on filtering the Address table.

I'm still a little confused about the best place to filter the Address table so that this can change the other business objects.  In the properties explorer the businessbindingsouce does not show any events, but when writing code, Intellisense shows that their are events for filtering the various tables.  Why is this?

mark

Mark Dowlearn
Mark Dowlearn
StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)
Group: Forum Members
Posts: 34, Visits: 9.9K
Ben -

I'm fooling around with this, and I see how the linkmanager is managing the addition/deletion of records, but I'm not able to figure out the filtering of related records.

For example, I have the following tables:  Address, Contact and AddressContact.  I've set up the linkmanager so that Address is Table 1, Contact is Table2 and AddressContact is the LinkTable.  I've dropped some grids and BBS objects on my form and all grids are being populated.

How would I display one Address record and then have the Contact and AddressContact tables be filtered to show only the related records?  I'm guessing I need to add an "AddressBO1.filter = XXXX" statement somewhere, but so far I have not been able to do this.  I've tried putting a SELECT statement that will result in only one record in the AddressBO ParentFormLoading() method, but even then all records are displayed once the form loads.

Any ideas on what I'm doing wrong?

Mark Dowlearn
Mark Dowlearn
StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)
Group: Forum Members
Posts: 34, Visits: 9.9K
Thanks, Ben -- I'll look at this further.

Yours,

Mark

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You would really want the link business object to be the child of both tables that participate in the many to many relationship.  However, since SF business objects can only have 1 parent business object, we created the BusinessLayerLinkManager.  It is a component that you drop on a form from the toolbox.  Set the appropriate properties (Table1, Table2, TableLink, and the PrimaryKey and ForeignKey properties) and it will manage the relationship for you.  You can see what it does by dropping some BusinessBindingSource objects on the form and binding each of the 3 business objects to a grid.  Then experiment with the properties on the BusinessLayerLinkManager and see how it handles changes to each of the outside business objects and the business object representing the LinkTable. 

Generally, you won't allow your users to have such a free-form style of editing, but you can see what it is accomplishing.  They will most likely select a single record on one side of the relationship and create/delete link records to attach that single record to the records other business object.

Mark Dowlearn
Mark Dowlearn
StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)
Group: Forum Members
Posts: 34, Visits: 9.9K
Hello,

I am evaluating SF for purchase and have a similar scenario where the database that I'm working with is fixed in its structure and has a number of tables with many-to-many relationships and link tables connecting them.

I'm not experienced enough with StrataFrame at this point to populate a checked TreeView, so I'm wondering if there's any further guidance that might be available on how to do this ... or if anyone is perhaps implementing the GUI as reflecting a one-to-many relationship at any given time using a listview or some other sort of repeater type of control. 

That is, in the example given earlier on the thread, if the UI is working primarily with viewing Dealer info on a given screen / panel / web page, the DealersDealerType BO would be the child object of the Dealer BO, and the DealerType BO would be a child of the DealersDealerTypeBO, thus showing a one-to-many relationship as seen from the Dealer BO perspective.

Any guidance would be greatly appreciated.

Yours,

Mark Dowlearn

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Not sure how other people do it, but when we have a link table scenario, we use the MicroFour.StrataFrame.UI.Windows.Forms.CheckedTreeView to maintain the link records.  You edit the main record and populate the tree with all of the possible selections from the opposing table.  Then we handle the NodeStateChanged event to add/remove records from the link business object and just Save() when we leave the form. 

We use a tree view because you can group the records by category, or something and select a whole group at once.  If it's a flat list, you can create a mover control or just use a checked list box and use the CheckedChanged event handler. 

Jason Stevenson
Jason Stevenson
StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)
Group: Forum Members
Posts: 15, Visits: 43
All:

I have 3 tables that represent dealers in my application.  The data structure must remain as it is.  I am trying to build a maintenance tool for the Dealers with the Strataframe tools.

I have a Dealer table, a DealerType table, and a DealersDealerType table.  A Dealer can have many DealerTypes, and a DealerType can be related to many Dealers.  This relationship is kept in the DealersDealerType table.

I am wondering should I use 3 Business Objects for the 3 tables, and if so, what is the best way to add/remove from the DealersDealerType table while editing a dealer.

I have a combo box on the Dealer edit form, that I want to be able to add or remove dealer types from a dealer record...

Or is there another method that is better suited for this type of relationship?

I know how I would do it without the Framework, but im trying to learn the Strataframe way...

Your help is appreciated,

Jason Stevenson
jstevenson72@gmail.com

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search