weird issue on databinding

Posts   
 
    
jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 15-Nov-2005 15:40:00   

OK, this is going to be hard to explain but...

Imagine a form with 2 grids on it. The upper grid is a parent grid. It has controls on the form under it. You pick a record and the controls populate through databinding etc. Below that is a detail grid with control under it also. You can add detail lines to the parent. All editing is done in controls and not in grid.

In most cases, this is a 1 to many relationship with 2 tables. Say parent with detail that has a foreign key back to the parent for the reference.

We do this in most cases, but in a few spots it's 3 tables as its not really detail records, but categories. For instance you have a vendor table and a vendor category table. There is a table in-between that's 2 fields, vendorid and category id so you get a many category to 1 vendor.

What if anything, does LLBL Gen see different about these 2 different situatations? Recently all of my forms that have the relational table in the middle have broken, but the ones that are plain parent child haven't. The code is the exact same for both situations, as it's mostly code on a base form and we inherit from that and only change the entity we're binding etc.

I've tried using the middle table for all the binding and also the vendorcategory collection on the vendor entity, but neither seem to work. I'm pretty sure we haven't done anything to break it or they all would be broken. Is there something I need to set/do to get the 3 table many to one to work?

Thanks!

jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 15-Nov-2005 15:40:51   

Also, I hit the done button instead of the bookmark button... flushed

<edit> but it seems to have gone away with the new post sunglasses

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 16-Nov-2005 12:12:13   

m:n relations are seen differently because it would otherwise lead to inconsisted code: what if there's a field added to VendorCategory which is not part of the PK? (objectified relation) You then can't 'secretly' save VendorCategory for a vendor.

Each vendor has a set of categories, via Vendor.VendorCategories[index].Category. My question now is: do you want to edit 'category' (the fields of category) or do you want to edit the relations between vendor and category?

Frans Bouma | Lead developer LLBLGen Pro
jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 16-Nov-2005 21:36:58   

I want to edit the relation between the 2 tables. IE I have a vendor with 2 categories of a possible 10. The user goes and add 3 more to the vendor, so we have 3 new records in the middle table.

after another day of working with this, I don't think it's llbl gen at all though now. There are a lot of combo's in our app that contain lists of things, such as the vendor category. We create inherited controls (from an infragistics ultracombo) and load them with the correct list on time and then drop them on the form when needed. So we have a vendor category combo, an account combo, a state combo etc etc.

It is actually a problem with them. If I drop a plain combo on the form and load it in the form load event with a collection of entities, the form works fine. If I use one of our inherited combos it fails. All we do in the inherited combo is override the onendinit event and load the combo with a collection of entities, so I don't see why it's failing, but it's not an llbl gen problem. Got something to do with event timing an binding somewhere... confused

Thanks for the reply though.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 16-Nov-2005 23:02:02   

In the OnEndEdit() override, do you call the base.OnEndEdit() method ? If not, you should. If not, the changes won't be propagated to the bound source.

Frans Bouma | Lead developer LLBLGen Pro
jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 17-Nov-2005 16:36:23   

Yeah, I noticed that we weren't doing that, but it didn't fix it unfortunately. I tried as the first thing of the override and also as the last.