user604613
user604613

Reputation:

Confused about protobuf-net WCF usage

I have been following this tutorial to add protobuf-net to my WCF project. I have a shared DTO library. Both server and Client use those DTO classes. I have attributed all my Service methods with [OperationContract] attributes, but i have not assigned any [DataContract] attributes on my DTO classes.

I added the protobuf-net Nuget package and added the configuration to the web.config.

I am using IIS Express to test my service, and thought that i should be ok with what i had done so far. However, after testing a few calls, i noticed that i forgot to add protobuf-net to my client and yet everything worked as expected (ie. no errors from serialization or deserialization).

I suspect that protobuf is not used in my program at all, and that i am missing something. I'd like to avoid using [DataContract] attributes but i could live with adding them, if that is what is need to get protobuf-net working.

What else am i missing?

Upvotes: 10

Views: 3122

Answers (1)

Sumit Maingi
Sumit Maingi

Reputation: 2263

A year ago I faced the same problem, where protoBuf seems to be an excellent option, with WCF it has some shortcomings.

I created an open source project to overcome these shortcomings, it uses protobu-net library and adds functionality to it, such that you don't need to share assemblies anymore with client. It however again requires you to put DataContract attributes though currently.

You can give it a try: https://github.com/maingi4/ProtoBuf.Wcf

DISCLAIMER: I am creator and owner of the above project.

Upvotes: 1

Related Questions