I am using protobuf-net on the project I am working on for the data contracts, creating the .proto files by hand and having the custom tool spew forth the C# code which it is duly doing.
I have also started using it for service contracts and the service interfaces are also created just fine.
For connectivity to some systems I am using WCF so I have enabled the datacontracts generator option and, although the the System.ServiceModel attributes are present, there does not appear to be any way for me to declare the specific faults the service may raise.
So my problem is basically:
- Protocol Buffers language does not appear to have any constructs for exceptions/faults.
- I cannot see any protobuf-net options for generating FaultContract attributes.
- The interface generated by protobuf-net is not declared partial so I cannot augment the generated code.
Is there any way to declare service WCF operation faults in protobuf-net or is this something that I would have to wait for version 2 for?
Many thanks.
I’m not sure why I don’t declare that as
partial interface, since that seems perfectly happy in C# 2.0; I’ll get that changed when I get a second, but note that you can apply a manual change locally – simply by editing the csharp.xslt file. Now, xslt isn’t everyone’s cup of tea, but it should be a 1-line change (near to the wordinterface) – in fact, it is probably the addition ofpartialhere:Since the the xslt is tweakable, you should be able to apply any other changes you require.