如何插入属性长于32kB的Azure存储表实体

问题描述 投票:0回答:1

当我有一个使用以下构造函数从TableEntity继承的类时:

public CacheEntity(string cacheType, string key, string value) {
    this.PartitionKey = cacheType;
    this.RowKey = key;
    this.Value = value;
}

并且我执行如下插入操作-当postsData的长度超过32768个字符时:

CacheEntity entity = new CacheEntity(CacheType.CategoryPosts, cacheKey, postsData.Substring(0, 32769));
TableOperation insertCacheOperation = TableOperation.Insert(entity);
await cacheTable.ExecuteAsync(insertCacheOperation);

[ExecuteAsync方法返回错误请求。

TableStorage文档指出Row and Property is 1MiB的最大大小>

例如,我可以通过将ExecuteAsync截断为32768而成功执行postsData

CacheEntity entity = new CacheEntity(CacheType.CategoryPosts, cacheKey, postsData.Substring(0, 32768));

是否有一个简单的修复程序允许TableEntity属性中的数据超过32KB?

[当我有一个使用以下构造函数从TableEntity继承的类时:public CacheEntity(string cacheType,string key,string value){this.PartitionKey = cacheType; this.RowKey = ...

c# azure azure-table-storage
1个回答
0
投票

找到的所有属性都有一个最大大小,但是每个属性也都有一个最大大小。根据documentation String values may be up to 64 KB in size. Note that the maximum number of characters supported is about 32 K or less.

© www.soinside.com 2019 - 2024. All rights reserved.