title: Serializing/Deserializing Protocol Buffers
body: <p>I am currently working with Protocol Buffers (version 3 C#).
  I am sending messages back and forth to different services.
  and currently trying to save some data stored in certain messages to a database (could be of any kind really).</p>
  
  <p>The problem being that <em>byte[]</em> is created as the type <em>ByteString</em> and <em>List&lt; T></em> is created as <em>RepeatedField&lt; T></em>.
  Now the issue I have with these are that I haven't managed to serialize or deserialize them 100% successfully.</p>
  
  <p>Basic types works like a charm, but Protocol Buffers own types can be a challenge.</p>
  
  <p>I tried <strong>AutoMapper</strong> and created maps which made ByteString possible to serialize/deserialize but the RepeatedField is hard since it is readonly and have a private setter and is not settable in the constructor.</p>
  
  <p>I cannot manage to get AutoMapper to map correctly to it, I wouldn't be surprised if there are more troubles along the way and was wondering if there are easier ways to save messages in a database?</p>
  
  <p>I have read older versions of protobuf where (if I'm not mistaken) there were so called builders that you could access properties for each message which were mutable and would have made serializing/deserializing much easier. Or is there a more apparent way to access the data and store it in a database that I am just not seeing?</p>
  
  <p>I understand the reason why messages are immutable but is there really no straight-forward way of saving the containg data to a database?
  Feels like an important feature.</p>
  
  <p>PS: I am aware that there is a protobuf-net solution which handles serializing/deserializing but it only supports protobuf v.2 and I am heavy dependent on v.3 features such as <em>Any</em>.</p>