-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Would be good to not use string comparison so much to see if an entity has changed.
Idea:
Store the initial state of an object as it's deserialized from the json and then compare the object to that initial state later.
Approach:
-
Use a custom contact resolver in json to add OnDeserializedCallbacks to store the initial state: https://www.newtonsoft.com/json/help/html/contractresolver.htm#CustomIContractResolverExamples
-
Use a reflection based (possibly using FasterFlect) approach to finding the state of the current instance. Have a look at https://github.com/replaysMike/AnyDiff/blob/master/AnyDiff/AnyDiff/DiffProvider.cs for inspiration on traversing complex objects.
-
Measure the performance improvements (if any!)
-
(Possibly) make it work for only known scenarios and fallback to current approach for non-supported ones