2

Is it possible somehow to add DataContract/DataMember attributes for existing binary classes (available only as compiled dll)? The main goal is to set DataMember name, to avoid ugly property names for generated proxies. I think, I am looking for something like metadata classes in WCF RIA services, but maybe there is some better approach. Thanks!

P.S. IL modification is not an option.

Anton Moiseev
  • 2,834
  • 4
  • 24
  • 30
  • No, I don't think so - you need to have the source to be able to add `[DataContract]` and `[DataMember]` attributes – marc_s Apr 15 '11 at 20:54

1 Answers1

0

In the end all the attributes are no more than a bit of metadata used to generate the WSDL and scheme. If you look at workflow services you will not find an interface with a ServiceContract and methonds with OperationContract but the same kind of WSDL is still generated by the WCF infrastructure. The same should be possible with a regular WCF service.

I have never done so but this blog post about programatically creating a WCF contract should point you in the right direction.

Maurice
  • 27,582
  • 5
  • 49
  • 62