Sharing constants across a WCF service

Posted by Sandor Davidhazi on Stack Overflow See other posts from Stack Overflow or by Sandor Davidhazi
Published on 2009-04-20T12:41:55Z Indexed on 2010/06/11 18:32 UTC
Read the original article Hit count: 578

Filed under:
|
|
|
|

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:

  1. Create a shared assembly and place the constants there
  2. 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?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET