views:

48

answers:

1

I have a data contract and I defined some constant variables in it and have [DataMember] tag for each constant variables. However, my client side does not retrieve those constant variables. I want those constant variables synchronized with the WCF service every time I update the metadata of my WCF service at my client side. I don't want to manually add or change by hand.

Does anyone know how to do it? Thanks!

+1  A: 

What kind of constants are you talking about? If it's just integers, why not use an enum instead?

Otherwise, there is no way to expose constants directly as part of your contract in the WSDL/mex, so either you'll need to share CLR types directly, or share the constants with your clients through other means (documentation, etc.).

tomasr
Can WCF share enum?By the way, what is CLR types?Thanks.
Peter
Enums are usually exposed on the WSDL (XSD supports them). CLR types are .net classes and structs.
tomasr
Thanks a lot Enums works.
Peter