Subsonic Compare Two Objects

subsonicsubsonic3

I would like to use this generic CompareObjects class but it seems that the Subsonic record objects don't implement IComparable.

User userFromDB = User.SingleOrDefault(x => x.UserName == "CmdrTallen");
User modifiedUser = new User();
TryUpdateModel(modifiedUser);
if(CompareOjbects<User>(userFromDB, modifiedUser) != 0)
{
    this.log("User was modified")
    //+ Add modified columns collection to log here
}

Am I re-inventing the wheel? Perhaps a easier way?

Best Answer

What I ended up doing is using this Generic Serializer to take both DB stored record (userFromDB) and modified user (modifiedUser). Serializing them to XML and then using this to create a diffgram. Exactly what I needed.

woot!