Rename property names from WCF service generated model

.net, c#, wcf

Solution

How about adapter pattern?

this would allow you to play with your class object myClass in your application, whereas when it is being passed on to the service you can have exposedClaSs which is auto generated.

Problem

I'm currently consuming a legacy WCF service that does not conform to the naming standards from the app in development. Now when developing against a REST service, where I create the models on my own it is really easy to rename a property like so: ``` [DataContract] public class SomeModel { [DataMember(Name = "id")] public string Id { get; set; } // ... } ``` But with the WCF service it generates the model, and I don't want to edit a generated file as all my changes would be lost when someone/-thing triggers the code generation again. So how could I achieve the same goal when consuming a WCF service?

Original source