Given I have a type we'll call Person defined as // psuedo codePerson {    Name: string;    Age: int;    Friends: Person[];    Career: Career // black box and assume that Career                    // is a type with a few arbitrary properties}Given I have two instances of the Person type, we will call p1 and p2p1 is filled up with information like Name = jim and  Age = 16 and p1.Friends = [3 other Person references]and p2 is filled up with different information like Name = bill and Age = 21 and p2.Friends = [5 other Person references]Now if I wanted to transform p1 into p2 there are a series of CRUD actions  could take like:p1.UpdateName(bill)p1.UpdateAge(21)p1.DeleteFriend(friends[i]) //For each of the current friends in p1 that are not in p2p1.CreateFriend(newFriends[j]) //For each of the friends in p2 that are not in p1  And now the data in p1 is equal to the data in p2.It is easy enough to take two objects of a specific known type, calculate the difference between them and produce a set of distinct actions that will transform one object into the other, I would like the generalize this workflow in a way that is designed to allow us to easily diff many different types of object and produce a common set of actions that can transform any instance of a particular type to any other instance of the same type.My question is: Is there an existing solution (library or common design) that solves what I am attempting to do? Will it account for deeply nested objects? Like in the example I have the career property in the Person type and If there were differences there, I would need to calculate actions for that as well.I don't want to try and reinvent the wheel on this if it's been done better, I just don't know what to search for in google when it comes to figuring out this design.If it helps at all the actual target language for this is C#.
Calculating object differences and the Actions Required to reconcile
design;design patterns;object oriented design
What you are trying to determine is called an object tree minimal delta. Googling around for those terms yielded this article which should get you going in the right direction.