views:

34

answers:

0

After objects get committed to the db, I sometimes want to update a separate index. The simplest version is something like:

if(ChangedObject.getType() == typeof(User))
    Update(((User) ChangedObject).UserID);

The problem is, if it's a related table, then the changed object won't be of the type User, just one of its properties will. I still might want to update what is linked though. For example, maybe an alias was updated, so I do

Update(((Alias) ChangedObject).User.UserID);

Apart from using reflections and looping through every property, is there a way to test if an entity references an object type?