c# - protobuf-net 缓存模型吗?
问题描述
我正在使用 Marc Gravell 的 protobuf-net
https://github.com/protobuf-net/protobuf-net
我有他跟随的模型
[ProtoContract]
public class PageControlsM
{
public PageControlsM()
{
PageControlsD = new ObservableCollection<PageControlsD>();
}
[ProtoMember(1)]
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[ProtoMember(2)]
public int PageRefno { get; set; }
[ProtoMember(3)]
public int OrderNo { get; set; }
[ProtoMember(4)]
public string ControlCode { get; set; }
[ProtoMember(5)]
[ForeignKey("ControlCode")]
public ControlTypes ControlTypes { get; set; }
[ProtoMember(6)]
[ForeignKey("ControlMRefNo")]
public ObservableCollection<PageControlsD> PageControlsD { get; set; }
}
我的模型中最初没有 OrderNo 属性。
所以我已经将它添加到我的模型中,并且可以看到用Protomember(3)
属性标记它。
当我运行我的应用程序时,出现以下错误
ProtoBuf.ProtoException: 'Invalid wire-type (String); this usually means you have over-written a file without truncating or setting the length; see https://stackoverflow.com/q/2152978/23354'
如果我将 OrderNo 的 protomember 值从 3 更改为 6 并相应地编辑其余的 protomember 值,一切正常,那么它是否将生成的 protobuf 模型缓存在某处?
非常感谢任何帮助
编辑
我很抱歉造成混乱,原因是,我们正在从远程服务器运行 Web 应用程序,而我的同事一直在服务器上的 localhost:5000 上运行 grpc 服务器。我已将 grpc 配置为在 localhost:5010 上运行,但是在调用 grpc 服务器时我已将端点硬编码为 localhost:5000 .. 所以一切都很好!
解决方案
推荐阅读
- android - 垂直和水平居中位图,同时保持其纵横比
- python - 是什么导致我用 Python 3 编写的自玩俄罗斯方块中出现这个奇怪的错误?
- sql-server - 在表格中选择结果范围内的后续数字
- python - 如何在 Django 项目启动期间编写数据库 Django 数据库模型实例?
- makefile - 使用 'dir &@ ' 作为 order-only-prerequisites 的目的是什么?
- python - 字典:当键是元组时附加到列表的值
- javascript - 渲染 fullcalendar v4 的问题
- python - ImportError:android kivy 启动器上没有名为请求的模块
- javascript - SAFARI:意外的令牌“=”。在方法的参数列表之前需要一个开头的 '('
- node.js - nodejs passport-azure-ad 重定向到 failureRedirect