This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
We are working on some auditing of field level changes to our Entities. We are using some reflection to get the old and new values. In the case of System Types, everything works fine. When we have associations we get a change on both the Object and the associated Id. How are these linked together, so we can choose to ignore the Id change. For example, TestObject.TestValue TestObject.TestValueId These both relate to the same thing, so we want to ignore the change to TestObject.TestValueId and only audit the change to TestObject.TestValue.
|
|
|
The Id is what is actually being persisted to the database to store the association and is set as part of underlying settor code for EntityHolder and EntityCollection properties. Without knowing too much about how your auditing is managed, perhaps the simplest approach would be a case of defining a map of the properties which are excluded from tracking and having the Id's covered using that strategy?
Jeremy
|
|
|
To add to Jeremy's comment, if you are using the designer, you can reliably assume that backreference associations and foreign key fields come in pairs, with the naming convention Xxx / XxxId. (In fact, I think you can make this assumption in handwritten code as well.) So when you receive a change notification for XxxId, you could check to see if the changing entity also has a property of type Xxx whose property type inherits from Entity, and if so do not audit the XxxId change. You could of course combine this with Jeremy's suggestion of a map of excluded properties, which might be faster than performing the reflective check every time. |
|