Azure 当我对存储表使用输入绑定时,如何访问RowKey(和PartitionKey)?
当我对存储表使用输入绑定时,如果没有错误“隐藏继承的成员的TableEntity.RowKey”,如何访问RowKey(和PartitionKey) 我可以基于PartitionKey愉快地访问类别,但是当我尝试扩展到获取RowKey时,通过向类添加新属性,我得到了一个错误<代码>警告CS0108:“Person.RowKey”隐藏继承的成员“TableEntity.RowKey”。如果要隐藏,请使用新关键字。Azure 当我对存储表使用输入绑定时,如何访问RowKey(和PartitionKey)?,azure,azure-storage,azure-functions,azure-table-storage,Azure,Azure Storage,Azure Functions,Azure Table Storage,当我对存储表使用输入绑定时,如果没有错误“隐藏继承的成员的TableEntity.RowKey”,如何访问RowKey(和PartitionKey) 我可以基于PartitionKey愉快地访问类别,但是当我尝试扩展到获取RowKey时,通过向类添加新属性,我得到了一个错误警告CS0108:“Person.RowKey”隐藏继承的成员“TableEntity.RowKey”。如果要隐藏,请使用新关键字。 #r "Microsoft.WindowsAzure.Storage" using Micr
#r "Microsoft.WindowsAzure.Storage"
using Microsoft.WindowsAzure.Storage.Table;
public static void Run(string myQueueItem,
IQueryable<Person> tableBinding, TraceWriter log)
{
log.Info($"C# Queue trigger:triggerblocklist processed message : [{myQueueItem}]");
// int i = tableBinding.Count();
// log.Info($"{i}");
foreach (Person person in tableBinding.Where(p => p.PartitionKey == myQueueItem)
.ToList())
{
log.Info($"RowKey: [{person.RowKey}]");
log.Info($"Categories: [{person.Categories}]");
}
}
public class Person : TableEntity
{
// public string PartitionKey { get; set; }
public string RowKey { get; set; } // !!!!!!!!!!!!!!!!!
// public string Timestamp { get; set; }
public string Categories { get; set; }
}
#r“Microsoft.WindowsAzure.Storage”
使用Microsoft.WindowsAzure.Storage.Table;
公共静态无效运行(字符串myQueueItem,
IQueryable tableBinding,TraceWriter日志)
{
log.Info($“C#队列触发器:triggerblocklist已处理消息:[{myQueueItem}]”);
//int i=tableBinding.Count();
//log.Info($“{i}”);
foreach(tableBinding.Where中的Person(p=>p.PartitionKey==myQueueItem)
.ToList())
{
log.Info($“RowKey:[{person.RowKey}]”);
log.Info($“类别:[{person.Categories}]”);
}
}
公共类人员:TableEntity
{
//公共字符串分区键{get;set;}
公共字符串行键{get;set;}/!!!!!!!!!!!!!!!!!
//公共字符串时间戳{get;set;}
公共字符串类别{get;set;}
}
TableEntity
您从中继承的类已经有一个名为RowKey
的属性,所以。。您的Person
类不需要定义名为RowKey
的属性,它已经通过其基类拥有该属性
您只需将
RowKey
属性从Person
类中删除,无需进行其他更改。是否有任何关于否决原因的反馈。。。这似乎不是一个完全愚蠢的问题,好吧,这是一个初学者的问题,但为什么要投反对票呢?谢谢,现在我明白你的意思了,很高兴说它很好用