Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

README.md

This is a custom IFormatter implementation based on the protobuf-net library by Marc Gravell, available at http://code.google.com/p/protobuf-net/

To serialize using protobuf you need to annotate your types with ProtoContract and ProtoMember or configure a RunTimeTypeModel object and pass it to the ProtoBufFormatter constructor.

To learn read, the protobuf-net docs, see examples in the protobuf-net source and the source of this repository.

Once you have configured your types, there are a couple of static methods to help you get the OrigoDB configuration right:

  //Annotate your model and entities with ProtoContract and ProtoMember
  // or create a type model from code:
  var typeModel = TypeModel.Create();
  //todo: add types, fields and subtypes to the typeModel
  
  
  var config = new EngineConfiguration();
  
  //use helper methods
  ProtoBufFormatter.ConfigureSnapshots<MyModel>(config, typeModel);
  ProtoBufFormatter.Configure(config, FormatterUsage.Results, typeModel);
  
  //or do it yourself
  config.SetFormatterFactory((cfg,fu) => new ProtoBufFormatter<MyModel>(), FormatterUsage.Snapshot);
  
  //use the config when creating an engine
  var db = Db.For<MyModel>(config);
  db.WriteSnapshot();

About

IFormatter wrapper for Protobuf serialization

Resources

License

Packages

No packages published
You can’t perform that action at this time.