有效的自定义天蓝色表存储实体序列化?

发布于 2024-11-30 14:17:05 字数 944 浏览 1 评论 0原文

有没有办法有效地自定义天蓝色表存储实体的序列化?我已经阅读了许多有关 ReadingEntity/WritingEntity 事件的帖子/主题,但我认为这不足以满足我的需要。我希望我的实体支持:

  1. 枚举类型属性;
  • 我已经测试了很多选项,更多选项对我不起作用,我收到异常(状态代码 500),未调用 ReadingEntity/WritingEntity 事件处理程序,并且实体未持久化。那么,事件处理程序方法不适用于此问题。
  1. 只读属性;
  • 在我的测试中,我收到异常(“封闭类型 System.String 没有相应的 S 可设置属性。”),但实体被持久化,那么也许我可以忽略该异常。 WriteEntity 事件处理程序被调用,但我认为我可能无法对异常做出任何处理。最大的问题是,当我加载对象时,没有调用 ReadingEntity 事件处理程序,那么我无法解决这个问题。那么,事件处理程序方法不适用于此问题。
  1. 瞬态/计算属性;
  • 我没有测试过,但我认为可以使用事件处理程序方法来实现,只需删除writingEntity 事件处理程序中的属性即可。
  1. PartitionKey/RowKey 元素的自定义名称;
  • 我没有测试过,但我认为可以使用事件处理程序方法来实现。我可以在实体类中使用 DataServiceEntity 属性,并在writingEntity 事件处理程序中将自定义名称重命名为所需名称。
  1. 没有公共默认构造函数。
  • 好的,这在我的测试中效果很好。

好吧,问题 1 和 2 对我来说仍然是一个大问题,有人知道我如何实现所有 5 个目标吗?

谢谢.. 此致..

Is there any way to effectively customize the serialization of an azure table storage entity? I already read many posts/topics about ReadingEntity/WritingEntity events, but I think that isn't sufficient for what I need. I want that my entities support:

  1. Enum types properties;
  • I have tested many options, more don't work for me, I receive an exception (status code 500), the ReadingEntity/WritingEntity event handlers aren't called and the entity is not persisted. Then, the event handlers approach doesn't work for this issue.
  1. Read-only properties;
  • In my test, I receive the exception ("The closed type System.String does not have a corresponding S settable property."), but the entity was persisted, then maybe I can just ignore the exception. The WritingEntity event handler is called, but I think that I maybe can't make nohting about the exception. The big problem is that the ReadingEntity event handler isn't called when I load the object, then I can't resolve this issue. Then, the event handlers approach doesn't work for this issue.
  1. Transient/calculated properties;
  • I have not tested, but I think that can be made with the event handlers approach, just remove property in the WritingEntity event handler.
  1. Custom names to PartitionKey/RowKey elements;
  • I don't have tested, but I think that can be made with the event handlers approach. I can use DataServiceEntity attribute in my entity class and make the rename, from my custom names to required names, in WritingEntity event handler.
  1. Don't have a public default constructor.
  • Ok, this has worked fine in my test.

Well, the issues 1 and 2 remain a big problem for me, anybody has any idea for I accomplish all 5 goals?

Thank's..
Best regards..

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

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

发布评论

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

评论(1

岁月苍老的讽刺 2024-12-07 14:17:05

我建议使用 Lokad.Cloud 的 FatEntity 方法。根据我们的经验,它更简单、更高效。

I would suggest the FatEntity approach of Lokad.Cloud. It's simpler and more efficient in our experience.

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