Viewing WCF in its use as a way to do RPC between remote PCs you can nicely just send an object as a method parameter. This is easy to code but means whenever the object changes you send the whole thing, and also potentially means the receiver has to have extra logic to only act on changed fields. Or you can have a class which has one method per attribute on the object. This fine-grained approach is great for performance if you have a large class and normally only change one attribute. But it's a lot more code to write, and you have to maintain it every time the object gains another attribute.
Is there a better approach which can avoid having to write a load of copy-paste methods for each attribute, but also only sends attributes that actually change? Can we auto-generate the WCF service methods from a class/interface or something?
For example say we have the (pseudo) classes, and the aim is two applications want to keep in sync about people (I add a complex attribute List to make it a bit more like real life):
class Pet
{
String name;
AnimalType type;
}
class Person
{
int age;
float height;
string name;
List<Pet> pets
}