Serialization and retrocompatibility
Hi. So i'm working on a client that communicates with a server using serialization. I need the old client to be able to communicate with the new server.
My problem is some of the fields in my app were created with auto properties (get; set;) way. And i now have to change them to private _id and public Id.
I've looked around and found that for the auto properties, the compiler Will create a private field called <Id>kBackingField. This property is used for serialization.
For now i've been using a custom serialization where i create the <nameof(Id)>kBackingField.
This isnt very pretty and i've also Just discovered it gets even worse with inheritance. Is there a way to fix this retrocompatibility problem in an easier way ?
My problem is some of the fields in my app were created with auto properties (get; set;) way. And i now have to change them to private _id and public Id.
I've looked around and found that for the auto properties, the compiler Will create a private field called <Id>kBackingField. This property is used for serialization.
For now i've been using a custom serialization where i create the <nameof(Id)>kBackingField.
This isnt very pretty and i've also Just discovered it gets even worse with inheritance. Is there a way to fix this retrocompatibility problem in an easier way ?