1
Vote

Customize Complex property

description

Hi, I want to customize a property that is a relationship (not the id itself) and audit it. So I would like to do:

CustomizeProperty(s => s.AddressDetail, a => a.ToString(), "Adresse");

In the current situation, I have to check if the modified column is AddressDetailId, and in that case perform a ToString() on the correct object, which is quite more complicated than the proposed solution.

comments

mhidinger wrote Dec 16, 2009 at 3:20 PM

Hi,

I don't fully understand the scenario here. Could you please add more details regarding the scenario you want to achieve, also please describe any current ways of achieving the desired result that are more complicated than it should be.

If possible, I would like to incorporate a solution into the upcoming release.

-Matt

tecGoblin wrote Dec 16, 2009 at 4:17 PM

Imagine I am auditing Subscribers. Each subscriber has an address (an address can be shared by many subscribers).
I would like to be able to track changes, on the Subscriber's level on
1) address' properties: CustomizeProperty(s=> s.Address, property => property.toString(), null /*The property name is selected by reflection"/)
(for example, if the postal code is changed, all the address' subscribers are marked with a modification in the associatedTable Address, and the ModifiedFields contain "PostalCode, oldValue, newValue")
2) the address as a whole (any change): CustomizeProperty(s=> s.Address, s.Address.ToString(), "Addresse")

Right now I have performed only the latter (for reasons of simplicity, if the subscriber's address is shared by other subsribers, we create a new address at the modification, so usually I have a change in the addressId). I did the latter:
CustomizeProperty(s => s.AddressId, a => a.ToString(), "Adresse");

The problem is that it doesn't capture all the changes (in case of changes that are not affected on the address id).

I think that a solution like the first would be possible if I tracked the changes in the level of the address as well, but instead of saving them on the level of the address, to save them on the level of the associated subscribers. The problem is that for each subscriber with a change in addressId, we have to actually compare its old address's old values to its new one's new values, field by field, to perform something like that.

Is this clearer?