开发者

Effective custom azure table storage entity serialization?

开发者 https://www.devze.com 2023-03-29 17:37 出处:网络
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 suffici

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..


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

0

精彩评论

暂无评论...
验证码 换一张
取 消