Frans,
I'm rolling my own data binding due to special requirements of my app. I've created various binding objects based on field types. In order to make my objects as generic as possible, I give these binding objects the field index of the field they'll bind to when I create them. When its time to save the entity, I pass in the entity which will receive the control's value.
Example:
PhoneNumberBinder Validates, parses, formats, phone number values
Has FieldIndex property
Has PhoneNumberControl property
Has SetEntityFieldValue(IEntity2 entityToSave) method
Has SetControlValue(IEntity2 entityToSave) method
When its time to save the entity, I call 'SetEntityFieldValue(entityToSave)'
Now I can use this object with any entity adding/editing screen that adds/edits an entity that has a phone number.
This works great until I have an entity adding/editing screen which adds/edits an entity with child entities. I need to be able to get child entities from their parent entities in a generic way (similar to the way fields can be generically accessed using the IEntity2.Fields collection) so that I can pass the child entities to their custom binding objects. I hope this makes sense.
Anyway, I'm guessing I'll have to use reflection since I don't see any methods/properties in IEntity2 that will allow me to have generic access to related entities or entity collections generically like I can with IEntity2.Fields. Any thoughts?
And thanks in advance.
PS
Mike: Thanks for the tip. It would be helpful if I didn't need to use the IEntity2 interface, but thanks anyway!