Profiles can be individuals or organizations. I have Profile as an ancestor class to individuals and organizations.
Now, all profiles have a collection of names (one of which is the primary). The thing is, Individual Names and Organization Names differ (Individual names have name parts & such), but they both implement IProfileName.
So what is important is that Profile holds a collection of ProfileNames. So my first intuition was to create a collection of type: ProfileNameCollection : BusinessListBase<ProfileNameCollection, IProfileName>.
There are two drawbacks - 1) the collection needs to know what kind of IProfileName it is dealing with when handling new rows. So I am, when the collection is created, having it carry along the "type of IProfileName" it is dealing with in a type member variable. And 2) because the collection is of IProfileName, when I bind it to a grid it's only letting me utilize members of the interface. This is especially a problem with respect to individual names, where I want to have the name parts.
Before I did this refactoring, I had two collections, IndividualNameCollection and OrganizationNameCollection. They each held IndividualName and OrganizationName members, respectively - but they were in the Individual and Organization classes and made dealing with "IProfile" records generically for names somewhat impossible. (Individuals and Organizations had the collections, not the Profile base class).
So I want to get this right and I thought I'd throw it out there to see if someone had a nice idea.
Thanks,
Chris
Copyright (c) Marimer LLC