Databinding with related entities

Posts   
 
    
Boone
User
Posts: 22
Joined: 21-Feb-2008
# Posted on: 14-Mar-2018 01:00:01   

Hi there, I'm in the process of upgrading from LLBLGen v2.6 to v5.3.

Running into an issue where related entities seem to be no longer accessible when using DataBinding.

My project has a custom control used for editing Addresses which includes all the text boxes/drop downs etc required to edit an Address entity. For example, on the form used for editing Supplier entities, this custom control is placed and its EditValue is bound allowing the Supplier's related Address entity to be modified.

Relevant bits of the .Designer file:

private SMS.UI.Control.Address address1;   // our customer control
this.supplierBindingSource.DataSource = typeof(SMS.Data.EntityClasses.SupplierEntity);
this.address1.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", this.supplierBindingSource, "Address", true));  // Address is the Navigator assigned to the relationship

With the new LLBLGen 5.3, this results in a runtime exception:

System.ArgumentException: 'Cannot bind to the property or column Address on the DataSource.'

We can also not bind regular controls to fields on related entities, which worked before:

this.emailTextEdit.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", this.supplierBindingSource, "Contact.Email", true));  // Contact is the Navigator assigned to another relationship

For this latter issue, I know I can add a Mapped Field to the Supplier entity and use that instead, but that doesn't help with the first issue.

Windows Forms .NET 4.6 Self-servicing PostgreSQL 10 LLBLGen v5.3 (5.3.3) RTM.

Thank-you!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 14-Mar-2018 15:04:57   

I think it has something to do with the attributes that we generate on the navigator properties by default.

Please go into settings -> Entity Model -> Code generation -> Attributes. Then pick 'NavigatorSingleValue' in the right pane as element type. You'll see 'Browsable($false)' as value. Select it and press DEL to delete it. Then click OK and regenerate.

Frans Bouma | Lead developer LLBLGen Pro