【问题标题】:Generate .proto file from a custom RuntimeTypeModel in protobuf-net从 protobuf-net 中的自定义 RuntimeTypeModel 生成 .proto 文件
【发布时间】:2015-06-17 15:59:19
【问题描述】:

使用protobuf-net,我希望从RuntimeTypeModel.Default以外的类型模型生成一个.proto文件:

RuntimeTypeModel myModel = TypeModel.Create();
myModel.Add(typeof(MyClass), true);
...
string myProto = Serializer.GetProto<MyClass>(); // Does not work, as it references RuntimeTypeModel.Default
  • 在这种情况下如何生成 .proto 文件?
  • GetProto()的源代码推断,我应该直接调用myModel.GetSchema(typeof(MyClass))吗?

【问题讨论】:

    标签: c# protobuf-net


    【解决方案1】:

    由于到目前为止没有人回答:
    调用 myModel.GetSchema(typeof(MyClass)) 确实有效,但我不确定这是不是正确的方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多