Hi,
I have created the following SmartObjects:
Customer(CustomerID, Name, Surname, ...) and Account(CustomerID, AccountID, AccountNumber, Date....)
I have associated them together on the CustomerID field in a 1 Customer to Many Account relationship.
My problem comes, when in ASPX, I attempt to enumerate all the associations of the SmartObjects.
I can pick up the SmartObjects with no problem.
When I run the following code, I only get associations for the Account SO:
SmartObject so = soServer.GetSmartObject(smartObject);
for (int i = 0; i < so.Associations.Count; i++)
{
Listbox1.Items.Add(so.Associations.SmartObject.Name);
for (int j = 0; j < so.Associations.AssociatedProperties.Count; j++)
{
Listbox1.Items.Add(so.Associations.AssociatedProperties.Name + " <-> " +
so.Associations.AssociatedProperties.MapTo + " ( " +
so.Associations.SoName + " ) ");
}
}
I think this happens because of the way the association is stored in the database.
The table SmartBroker.dbo.Associations has the following fields (the important ones only):
SmartObjectName: Account
RefSmartObjectName: Customer
AssociationType: onetomany
My guess is that the associations are only loaded on the SmartObject field and not the RefSmartObject (using the GUID, not the physical name).
I need to be able to follow all associations in both directions but I'm not sure if it is possible.
Any suggestions?
Thanks
Mike