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:
- 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.
- 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.
- 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.
- 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.
- 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.
精彩评论