sai*_*mar 1 .net c# azure azure-storage azure-web-app-service
我正在尝试使用存储连接字符串将一些测试值插入到 Azure 表中。当我尝试执行插入操作时,它显示错误,因为无法将 TableStorage.RunnerInputs 转换为 Microsoft.azure.cosmosDB.table.itableentity。我正在参考https://learn.microsoft.com/en-us/azure/cosmos-db/table-storage-how-to-use-dotnet来解决这个问题
*
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
//Create the table client.
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
//Create the CloudTable object that represents the "people" table.
CloudTable table = tableClient.GetTableReference("InputParameters");
table.CreateIfNotExists();
//Create a new customer entity.
RunnerInputs RunnerInput = new RunnerInputs("OnlyDate", "rowkey");
//CloudTable test = null;
RunnerInput.InputDate = "20180213";
//Inputvalue = "20180213";
//Create the TableOperation object that inserts the customer entity.
TableOperation insertOperation = TableOperation.Insert(RunnerInput);
//Execute the insert operation.
table.Execute(insertOperation);
Run Code Online (Sandbox Code Playgroud)
跑者级别
namespace TableStorage
{
public class RunnerInputs:TableEntity
{
public RunnerInputs(string ParameterName,string RowValue)
{
this.PartitionKey = ParameterName;
this.RowKey = RowValue;
}
public string InputDate { get; set; }
}
}
Run Code Online (Sandbox Code Playgroud)
错误截图供参考。谁能告诉我我们怎样才能克服这个问题?已尝试通过转换值,但结果是相同的。

| 归档时间: |
|
| 查看次数: |
2731 次 |
| 最近记录: |