RavenDb - 由于属性名称重复而无法存储

发布于 2024-12-08 08:46:33 字数 168 浏览 2 评论 0原文

我正在尝试在 Raven 中存储文档 - 但子类隐藏了基类上的属性 - 名称相同但类型不同。当我尝试保存它时,出现此错误:

““帐户”上已存在名为“用户”的成员。使用 JsonPropertyAttribute 指定另一个名称

但是,该类是密封的,我不拥有它或不能拥有它我还有什么选择吗?

I'm trying to store a document in Raven - but a subclass hides a property on a base class - same name but different type. When I try and save it, I get this error:

"A member with the name 'User' already exists on 'Account'. Use the JsonPropertyAttribute to specify another name

However, the class is sealed and I don't own it or cannot extend it. Do I have any options at all?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无所的.畏惧 2024-12-15 08:46:33

如果您可以修改尝试存储的类,则可以设置 JsonContract(在 DocumentConventions 上)并修改它从那里序列化的方式。

If you can modify the class that you are trying to store, you can set the JsonContract (on the DocumentConventions) and modify how it gets serialized from there.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文