protobuf-net

Are there any Tutorials for Protobuf-net?

I have been reading about protobuf-net and it is amazing! Are there any tutorials that I could use? (More specifically for Dictionary<TKey,TValue> and contracts for generics) Are there any tips associated with it? Could I simply plug it into my current codebase or are there any changes I need to do? ...

protobuf-net NOT faster than binary serialization?

I wrote a program to serialize a 'Person' class using XMLSerializer, BinaryFormatter and ProtoBuf. I thought protobuf-net should be faster than the other two. Protobuf serialization was faster than XMLSerialization but much slower than the binary serialization. Is my understanding incorrect? Please make me understand this. Thank you for ...

Is it necessary to declare attribute [DataMember(Order=n)] on public method?

In my solution, I have created public class to store value and already declare [DataContract/DataMember] attribute. For example, [DataContract] public class MeterSizeInfo { string _meterSizeId; [DataMember(Order = 1)] public string MeterSizeId { get { return this._meterSizeId; } set { this._meterSizeId ...

How can I send multiple types of objects across Protobuf?

I'm implementing a client-server application, and am looking into various ways to serialize and transmit data. I began working with Xml Serializers, which worked rather well, but generate data slowly, and make large objects, especially when they need to be sent over the net. So I started looking into Protobuf, and protobuf-net. My probl...

Dynamic Object Serialization

Hello everyone, I tried to serialize a DynamicObject class with BinaryFormatter, but: Output file is too big, not exactly wire-friendly Circular References not handled (stuck while serializing) Since serializing a DynamicObject means very little by itself, here's the class I tried to serialize: [Serializable()] class Entity : Dy...

protobuf-net v2 alpha - problems with Dictionary<string,string>?

I was using a version of v2 of protobuf-net from a few weeks ago quite successfully. (I want to use V2 due to the speed of the pre-compiled serializer running on the Compact Framework.) Everything worked great until I tried to serialize an object with a property of type Dictionary. I received the following error: {"No serializer defined...

With Protobuf-net, does it allow deserialization reuse existing instances if they are the same?

I'm using Protobuf-net. Suppose I have a list of Gizmo objects serialized and that each gizmo object reference a Gazoo object. The Gazoo object might be the same object referred by several Gizmo objects. How would deserialization work in this situation? Would I get more than one copies of Gazoos for the same referred one in the gizmo o...

What's the .proto equivalent of List<T> in protobuf-net?

To keep some consistency, we use code generation for a lot of our object models, and one of the offshoots of that has been generating the .proto files for ProtocolBuffers via a separate generation module. At this point though, I'm stumped at how to implement the generation for when it happens upon a List<T> object. It looks like this is...

Protobuf-net and and generics

I have a problem with protobuf-net and the use of generics. Given: [DataContract] public class CacheData { [DataMember(Order = 1)] public List<CacheLoadItem<int>> Foo; [DataMember(Order = 2)] public List<CacheLoadItem<int>> Bar; [DataMember(Order = 3)] public List<CacheLoadItem<int>> XXX; [DataMember(...

Why I have to use [ProtoInclude]?

I have read many questions about inheritance feature in protobuf-net. I just wonder that if I can use [DataContract],[DataMember] in the same way of using [ProtoContract],[ProtoMember]. Why I could not use [KnowType] instead of using [ProtoInclude]? I raise this question because I used [DataContract],[DataMember] for protobuf-net's seri...

How to serialize interface-typed members with protobuf .NET?

Hello, The following test fails with this error: "System.InvalidOperationException : No suitable Default IB encoding found." [ProtoContract] public class A { [ProtoMember(1)] public IB B { get; set; } } public interface IB { } [ProtoContract] public class B : IB { [ProtoMember(1)] public int SomeProperty { get;...

Reading a Protobuf Message in C#

I have a simple message: package test; message sendName { optional string username = 1; } The awesome VS plugin generates the .cs file: namespace test { [global::System.Serializable global::ProtoBuf.ProtoContract(Name=@"sendName")] public partial class sendName : global::ProtoBuf.IExtensible ...

Using bool type in Proto-Buf

I am using protobuf-net in my application for serializaion/deserialization. I am facing an issue. [ProtoContract()] ClsTest { private bool _isPeriodic [ProtoMember(1)] public bool IsPeriodic { get { return _isPeriodic; } set { isPeriodic = value; ...

Protocol Buffers over HTTP GET using WCF

I have a WCF service hosted that is returning a byte[] of protobuf-net serialized data. Originally this was hosted over the default webHttpBinding settings (SOAP) and everything was working properly. I recently found out that I need to call HTTP GETs and POSTs directly from our client so I thought it'd be easier to switch to use a RESTfu...

Asynchronous approach to using streams with sockets

I've always built my own serializers/deserializers to be able to use BeginReceive/EndReceive with sockets to avoid using one thread per connected socket. It's a quite time consuming task. I've started to look at protobuf-net and want to used it with async sockets without having to write serialization/deserialization myself. I would pref...

protobuf-net and rpc over tcp

I'm looking for a rpc over tcp implementation that uses protobuf-net (or any other .net implementation of protobuf). Any suggestions? ...

API to know the kind of protobuf Message being sent in

What is the API to know the kind of protobuf Message is being sent? For example I use the following to get the SendNameMessage object. SendNameMessage sendNameObj = Serializer.DeserializeWithLengthPrefix< SendNameMessage>(stream, PrefixStyle.Fixed32); How does a listener know what kind of message is being sent? The following ...

Protocol buffer net with windows phone 7

I'm trying to download a response from a server wich is in Protocol Buffer format from a Windows Phone 7 application. I'm trying to do this with a WebClient, my problem is the following. The WebClient has only two method for downloading DownloadStringAsync(new Uri(url)); and OpenReadAsync(new Uri(url)); but this two method are...

Protobuf-net: Instances of abstract classes cannot be created.

...

protobuf-net, how does it do?

We use .net binary serialization right now to serialize data to persist. It does the job but doesn't fell like it's intended to use for that purpose as changing data is not so trivial. So i started looking into protobuf as it is designed around that purpose. i am looking at protobuf-net to how to use it. Below are some thing i don't k...