简体   繁体   English

如何使用Azure存储表服务处理实体转换错误

[英]How to handle entity casting errors with Azure Storage Table Service

I fear this might be quite the simple question, but honestly I've read the documentation and I don't understand. 我担心这可能是一个非常简单的问题,但是老实说我已经阅读了文档,但我听不懂。

When using an Azure Storage Table, I understand that I set a Partition and Row Key then pass in the object I want to have saved in the entity. 当使用Azure存储表时,我了解我先设置了分区和行键,然后传入想要保存在实体中的对象。

Now, these are my questions? 现在,这些是我的问题吗? Once the first object is set, can subsquent objects have different structure? 设置第一个对象后,后续对象可以具有不同的结构吗?

What if I don't know the structure of an entity. 如果我不知道实体的结构该怎么办。 Can I use a URL to discover it? 我可以使用URL来发现它吗?

Without using Azure Storage explorer, is there any way to retrieve the structure of objects on a list of entities? 如果不使用Azure Storage Explorer,是否有任何方法可以检索实体列表上的对象结构?

Every row in an azure table can have a completely different type of object, so the answer to your 1st question is yes. 天蓝色表中的每一行都可以具有完全不同的对象类型,因此第一个问题的答案是肯定的。

If you do not know the structure of the entity stored, then you can retrieve the entity as DynamicTableEntity . 如果您不知道所存储实体的结构,则可以将实体检索为DynamicTableEntity DynamicTableEntity comes with an EntityProperty dictionary. DynamicTableEntity带有EntityProperty词典。 The key in the dictionary is the name of the property and the value is the EntityProperty . 字典中的键是属性的名称,值是EntityProperty The EntityProperty contains both a PropertyType property and the actual value of the property from the original object. EntityProperty包含PropertyType属性和原始对象中属性的实际值。 This should give you a good idea of the shape of the object that is written to table storage. 这应该使您对写入表存储的对象的形状有个好主意。 There is no URL functionality to get the type. 没有URL功能来获取类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM