有没有办法可以覆盖TableEntity的RowKey属性的getter?
答案 0 :(得分:0)
我认为可以使用 new 关键字来覆盖getter:
public class Person : TableEntity
{
public Person(string name, string surname)
:base(surname, name)
{
}
public new string PartitionKey
{
get { return "OhLala" + base.PartitionKey; }
}
public new string RowKey
{
get { return "ohMama" + base.RowKey; }
}
}
答案 1 :(得分:0)
以下是实施ITableEntity界面的代码段
public class TestEntity : ITableEntity
{
private string _rowKey;
public TestEntity()
{
this.Properties = new Dictionary<string, EntityProperty>();
}
private IDictionary<string, EntityProperty> Properties { get; set; }
public void ReadEntity(IDictionary<string, EntityProperty> properties, Microsoft.WindowsAzure.Storage.OperationContext operationContext)
{
this.Properties = properties;
}
public IDictionary<string, EntityProperty> WriteEntity(Microsoft.WindowsAzure.Storage.OperationContext operationContext)
{
return this.Properties;
}
}