Sharing constants across a WCF service
- by Sandor Davidhazi
I have certain strings which contain special characters so they can not be shared as enum members across a WCF service. (Actually, they are keys for configuration values.)
I want to be able to pass in the keys at client side and get back the config values. If there is a change, I only want to change the config keys at one place.
Constants would be ideal, because they can be changed as strong references across the entire solution, and the underlaying value could be updated with a service reference update.
Currently I can think of two possible solutions:
Create a shared assembly and place the constants there
Share the constants across the service.
The problem is, I can't get the datacontractserializer to serialize the constants. Is that possible at all? Is the shared assembly the only option I have?