本文整理匯總了C#中Microsoft.WindowsAzure.Storage.Table.DynamicTableEntity.Serialize方法的典型用法代碼示例。如果您正苦於以下問題:C# DynamicTableEntity.Serialize方法的具體用法?C# DynamicTableEntity.Serialize怎麽用?C# DynamicTableEntity.Serialize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Microsoft.WindowsAzure.Storage.Table.DynamicTableEntity
的用法示例。
在下文中一共展示了DynamicTableEntity.Serialize方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: UpdateEntity
private async Task UpdateEntity(CloudTable table, DynamicTableEntity entity)
{
try
{
await table.ExecuteAsync(TableOperation.Merge(entity)).ConfigureAwait(false);
return;
}
catch(StorageException ex)
{
if(!Helper.IsError(ex, "EntityTooLarge"))
throw;
}
var serialized = entity.Serialize();
Configuration
.GetBlocksContainer()
.GetBlockBlobReference(entity.GetFatBlobName())
.UploadFromByteArray(serialized, 0, serialized.Length);
entity.MakeFat(serialized.Length);
await table.ExecuteAsync(TableOperation.InsertOrReplace(entity)).ConfigureAwait(false);
}
示例2: CanSerializeDeserializeTableEntity
public void CanSerializeDeserializeTableEntity()
{
DynamicTableEntity entity = new DynamicTableEntity("partition", "row");
entity.Properties.Add("propertyname", new EntityProperty("propertyvalue"));
var val = entity.Serialize();
DynamicTableEntity entity2 = new DynamicTableEntity();
entity2.Deserialize(val);
Assert.Equal("partition", entity2.PartitionKey);
Assert.Equal("row", entity2.RowKey);
Assert.Equal("propertyvalue", entity2.Properties["propertyname"].StringValue);
Assert.True(entity2.Serialize().SequenceEqual(entity.Serialize()));
}