On my client side, I want the default C# constructors from my WCF service C# classes. There reason we want to do this is to have the default values from the server side classes on the client side. From the searches I've done, there are 2 ways to go about this:
- When I need a default instance of the object I make a server call that returns me the default instance
- I create a client side C# class which inherits from the server side C# class and copy paste the constructor and use this constructor
Is either one of these the "better" option? or is this heavily dependent on how often I would need a new instance of the object?
EDIT: We tried using [System.Runtime.Serialization.OnDeserialized]
seen here but it's not working. We are also not using the DataContract
attribute in our class, we use ServiceKnownType
instead