即使所有具体类型现在都引用新版本的接口,我是否可以将对象反序列化回原始接口
我遇到了这个大问题,由于各种原因,我必须将接口定义更改为不同的东西。该接口被序列化为数据库中的 blob。现在我正在尝试将旧的 blob 迁移到新的 blob 中。但我设法将原始合同定义与修改后的接口定义并排维护。但是所有引用旧接口的具体类型现在都引用该接口的新修改版本。
我的代码库中仅存在旧的接口定义。因此,当我尝试将此 blob 从数据库加载回旧合同定义时,我
在反序列化时收到“对象无法存储在这种类型的数组中”错误。有人可以帮忙吗?...
在尝试将 blob 反序列化回旧的接口定义时,我还需要旧版本的具体类型吗?
任何帮助将不胜感激。因为我真的被困住了。
谢谢, 股份公司
I am running into this massive problem, I have to for various reasons change the Interface defintion to something different. This interface was serialised as a blob into the database. Now i am trying to do the migration of old blob into new blob . But i have managed to maintain the original contract defintion side by side to my modified interface definition. But all the concrete types which were to reference the old interface now reference the new modified version of the interface.
Only old interface defintion exists in my code base. So when i am trying to load this blob back from database to old contract defintion i get
"Object cannot be stored in an array of this type" error while deserializing. Can someone please help.?...
Also do i still need old version of concrete types while trying to de-serialize the blob back into old interface defintion?.
any help would be appreciated. As i am really stuck.
Thanks,
AG
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您看过 SurrogateSelector 类吗?当需要此类更改时,它可以帮助控制反序列化。
Have you looked at the SurrogateSelector class ? It can help in taking control of deserialization when such a change of class is needed.