简体   繁体   English

无法转换为microsoft.azure.cosmosDB.table.itableentity

[英]cannot convert to microsoft.azure.cosmosDB.table.itableentity

I'm trying to insert some test values into an Azure table using storage connection string. 我正在尝试使用存储连接字符串将一些测试值插入到Azure表中。 When I tried to perform insert operation it showing error as cannot convert TableStorage.RunnerInputs to Microsoft.azure.cosmosDB.table.itableentity. 当我尝试执行插入操作时,它显示错误,因为无法将TableStorage.RunnerInputs转换为Microsoft.azure.cosmosDB.table.itableentity。 I'm working on this with the reference to https://docs.microsoft.com/en-us/azure/cosmos-db/table-storage-how-to-use-dotnet 我正在通过参考https://docs.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);

Runner class 跑步班

namespace TableStorage
{
 public  class RunnerInputs:TableEntity
    {
        public RunnerInputs(string ParameterName,string RowValue)
        {
            this.PartitionKey = ParameterName;
            this.RowKey = RowValue;
        }
        public string InputDate { get; set; }

    }
}

Error Screenshot for reference. 错误屏幕截图以供参考。 Can anyone let me know how can we overcome this? 谁能让我知道如何克服这个问题? Have tried by casting the value, but the result is same. 尝试通过强制转换值,但是结果是相同的。

错误图片供参考

Can anyone let me know how can we overcome this? 谁能让我知道如何克服这个问题?

It seems that your problem is TableEntity package reference can not be matched with TableOperation package reference. 看来您的问题是TableEntity包引用无法与TableOperation包引用匹配。 The Azure Comos DB and Azure Table Storage are different tables. Azure Comos数据库和Azure表存储是不同的表。 Their packages don't work with each other. 他们的包裹不能互相配合。 You could use the same package reference for these classes to solve your problem( like 'Microsoft.WindowsAzure.Storage.Table'). 您可以对这些类使用相同的程序包引用来解决您的问题(例如“ Microsoft.WindowsAzure.Storage.Table”)。
The result is like this: 结果是这样的: 在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将字符串转换为 Microsoft.WindowsAzure.Storage.Table.ITableEntity? - How can i convert a string to Microsoft.WindowsAzure.Storage.Table.ITableEntity? 使用Microsoft.Azure.Storage(cosmosDB)更新表对象失败 - Update table objects using Microsoft.Azure.Storage (cosmosDB) fails Azure 表存储 - 用于扩展 ITableEntity 的任何类型的通用下载 - Azure Table Storage - Generic download for any type extending ITableEntity 安装Microsoft.Azure.CosmosDB.Table NuGet时出错 - Error installing Microsoft.Azure.CosmosDB.Table NuGet 无法将 Microsoft.Azure.Cosmos.Table.DynamicTableEntity 转换为 System.Threading.Task.Task <microsoft.azure.cosmos.table.dynamictableentity></microsoft.azure.cosmos.table.dynamictableentity> - Cannot convert Microsoft.Azure.Cosmos.Table.DynamicTableEntity to System.Threading.Task.Task<Microsoft.Azure.Cosmos.Table.DynamicTableEntity> 没有来自的装箱转换或类型参数转换 <T> 到&#39;Microsoft.WindowsAzure.Storage.Table.ITableEntity&#39; - There is no boxing conversion or type parameter conversion from <T> to 'Microsoft.WindowsAzure.Storage.Table.ITableEntity' 如果是全局复制,Microsoft.Azure.CosmosDB.Table是否会自动选择到cosmos DB的最低延迟路由? - Does Microsoft.Azure.CosmosDB.Table automatically choose the lowest latency route to the cosmos DB if replicated globally? 我可以为无服务的 Azure CosmosDB(Azure 表)动态创建表吗? - Can I create dynamically a table for a serveless Azure CosmosDB (Azure Table)? 无法将类型&#39;Microsoft.Azure.Documents.Document&#39;隐式转换为&#39;System.Web.Http.IHttpActionResult&#39;。 - Cannot implicitly convert type 'Microsoft.Azure.Documents.Document' to 'System.Web.Http.IHttpActionResult'. 使用Microsoft.Bot.Builder.Azure(bot Framework v4)为CosmosDB中的容器中的项目设置时间限制 - Set time limit for items in container in CosmosDB using Microsoft.Bot.Builder.Azure (bot framework v4)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM