Ответ 1
Да! Ваше понимание верное.
Вы можете протестировать его, выполнив следующий код С# с правильными connectionString
и tableName
:
class MyEntity : TableEntity
{
public string MyString { get; set; }
}
class MySecondEntity : TableEntity
{
public string MySecondString { get; set; }
}
public void MergeTest()
{
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
CloudTable table = tableClient.GetTableReference(tableName);
table.CreateIfNotExists();
// Insert an entity
table.Execute(TableOperation.Insert(new MyEntity()
{ PartitionKey = "partition", RowKey = "row", MyString = "randomString" }));
// Merge with a different class
table.Execute(TableOperation.InsertOrMerge(new MySecondEntity()
{ PartitionKey = "partition", RowKey = "row", MySecondString = "randomSecondString" }));
}
В вашей таблице должно быть указано единственное сущность со следующими свойствами:
{
PartitionKey = "partition",
RowKey = "row",
MyString = "randomString",
MySecondString = "randomSecondString"
}