Reputation: 928
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:
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?
Upvotes: 1
Views: 1689
Reputation: 245429
If it were me, I'd be keeping my config values in an external config file. You can store the key/value pairs in the config file and then allow all your assemblies to access the file. That way, config values can be changed without re-compiling your assemblies, and can be accessed from any of your services simultaneously.
Upvotes: 2