I'm having trouble binding to a property of an object within my parent object using adapter and prefetch path.
Schema has a 1-m relationship 'Account' to 'Contact'.
Each Account should have one contact defined by it's foreign key, and I am retrieving this successfully using the prefetch path:
i.e.
PrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.AccountEntity);
prefetchPath.Add(AccountEntity.PrefetchPathContact);
I am binding my IEntityCollection2 '_model' to a bindingsource once the data has been retrieved, and if I cast an item in the collection to an AccountEntity I can see that the 'Contact' object has been retrieved.
/// <summary>
/// Bind Controls to the DataSource
/// </summary>
public void BindControls()
{
this._accountBindingSource.DataSource = _model;
this._accountNameTextBox.DataBindings.Add("Text", _accountBindingSource, "AccountName");
this._accountNumberTextBox.DataBindings.Add("Text", _accountBindingSource, "AccountNumber");
this._accountDetailsMCodeTextBox.DataBindings.Add("Text", _accountBindingSource, "MCode");
this._accountDetailsNotifyCheckBox.DataBindings.Add("Text", _accountBindingSource, "Notify");
this._accountDetailsPinTextBox.DataBindings.Add("Text", _accountBindingSource, "Pin");
this._accountDetailsContactTelephoneNumberTextBox.DataBindings.Add("Text", _accountBindingSource,"Contact.LastName");
BindTreeView();
this._dataBound = true;
}
However, binding fails when binding to 'Contact.LastName' with the following message.
'DataMember property 'Contact' cannot be found on the DataSource.'
Looks to be related to the Browsable attribute?
Any Ideas?