Both, really. And of course by the time you are embedding **type** metadata into the file you have ceased to be portable (or contract-based). This is potentially something that could be added as a non-portable feature of a single implementation, but *in most cases* there are ways to do it **inside** the portable spec, and I'd rather push people towards using portable options unless there is no feasible alternative.
Marc On 1 February 2011 01:58, Richard Geary <[email protected]> wrote: > What sort of restrictions are in the Google protobuf spec? Is this possible > as a user-extension of the protobuf-net library? eg. Could I create an > object surrogate, serializing the name of the derived type as a string, then > dynamically read/write the type to the stream based on the type string? Or > does the spec make this not possible because it forces a static message > structure? > > > > Thanks! > > > > > > *From:* Marc Gravell [mailto:[email protected]] > *Sent:* 31 January 2011 01:06 > *To:* NYCBrit > *Cc:* Protocol Buffers > *Subject:* Re: [protobuf] Serializing Dictionary<string,object> > > > > I assume you mean with protobuf-net there; in which case, no. > > > > Because protobuf-net follows the general protobuf spec, there is no > type-specific metadata that would allow me to encode/decode an arbitrary > object, or to store the details of which type of object is stored. > > > > Marc (protobuf-net) > > On 29 January 2011 16:03, NYCBrit <[email protected]> wrote: > > Is it possible to serialize a Dictionary<string,object> where all the > objects are pointing to classes marked up with [ProtoContract]? > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<protobuf%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/protobuf?hl=en. > > > > > -- > Regards, > > Marc > -- Regards, Marc -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
