[英]Microsoft.Azure.Cosmos.Tables to Azure.Data.Tables migration: TableEntity Inheritance
I am trying to migrate some legacy code from Microsoft.AzureCosmos.Tables to Azure.Storage.Tables.我正在尝试将一些遗留代码从 Microsoft.AzureCosmos.Tables 迁移到 Azure.Storage.Tables。 The TableEntity class is sealed in Azure.storage.Tables, so how do I fix this?
TableEntity class 被密封在 Azure.storage.Tables 中,那么我该如何解决呢?
public class HistoricalValues : TableEntity
{
public string tName { get; set; }
public double tValue { get; set; }
public int fTagId { get; set; }
public string date { get; set; }
}
Do I just add the PartitionKey, RowKey, eTag, etc properties?我是否只添加 PartitionKey、RowKey、eTag 等属性? Eg
public string PartitionKey { get; set; }
例如
public string PartitionKey { get; set; }
public string PartitionKey { get; set; }
public string PartitionKey { get; set; }
? public string PartitionKey { get; set; }
?
I don't really understand inheritance, so pointing me at a decent explanation/sample code would also be appreciated.我真的不明白 inheritance,所以指出我一个体面的解释/示例代码也将不胜感激。
I've been migrating some legacy code myself.我一直在自己迁移一些遗留代码。 Azure.Storage.Tables follows a slightly different albeit improved paradigm for working with CosmosDB and Azure tables.
Azure.Storage.Tables 在使用 CosmosDB 和 Azure 表时遵循稍微不同但有所改进的范例。 Instead of inheriting TableEntity, your table entity classes implement ITableEntity, which as you mentioned requires you to add the RowKey, PartitionKey, ETag and Timestamp properties.
您的表实体类不是继承 TableEntity,而是实现 ITableEntity,正如您提到的那样,它需要您添加 RowKey、PartitionKey、ETag 和 Timestamp 属性。
There are other changes besides the table entity implementation.除了表实体实现之外还有其他变化。 This article has some good information with a walkthrough using ITableEntity.
本文提供了一些很好的信息,其中包含使用 ITableEntity 的演练。
The Microsoft information on this is a little less helpful, especially for migrating existing code from TableEntity to ITableEntity. Microsoft 关于此的信息帮助不大,尤其是对于将现有代码从 TableEntity 迁移到 ITableEntity。 Here's that documentation .
这是该文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.