Quantcast
Channel: CSLA .NET
Viewing all articles
Browse latest Browse all 764

PropertyChanged Notifications with "using relationships"

$
0
0

I was hoping that someone could lend some ideas on how to properly setup a scenario I'm working with:

In my situation, I have a parent business object which uses another object as a property.  As a simple example, consider this parent is a "Person" and the property is "FavoriteColor".  In the user interface, the "FavoriteColor" property would be selected from a list of "Color" items, which are separately maintained & edited in a "Colors" collection.

Since the "Color" objects can be used by many "Person" objects, I understand the most appropriate way to set the "FavoriteColor" property on the "Person" is by storing the ID of the "Color" object and not a reference to the actual instance of the "Color" itself.  In other words, a "using relationship" model.

However, by only storing the ID of the object, it seems that the "Person" will not be aware of any changes which occur to the properties of the "Color" object.

My question is: When applying the "using relationship" model and only the ID of the referenced "Color" object is stored, what is the best way to make sure the "Person" is aware of changes made to the assigned "Color" item?

My best guess is that this will require I set up a listener on the "Color" item when the ID is assigned to the "FavoriteColor" property.

Thanks for your help!

 


Viewing all articles
Browse latest Browse all 764

Trending Articles