![](/img/trans.png)
[英]There is no boxing conversion or type parameter conversion from <T> to 'Microsoft.WindowsAzure.Storage.Table.ITableEntity'
[英]How can i convert a string to Microsoft.WindowsAzure.Storage.Table.ITableEntity?
您好,在此先感謝您提供的所有幫助:我在更新我的 azure 表時遇到問題,我不確定我正在做什么。 1.將 json 解析為 var 2.使用另一個 eg test = parsedJson;latest 創建該 var 的實例。 3. 使用帶有表操作的 var(自動分配的字符串)來插入或替換表實體:使用的代碼如下:
var o365Subnet = JsonConvert.DeserializeObject<ConvertJson>(o365Latest);
var o365Final = o365Subnet.latest;
TableOperation tableOperation = TableOperation.InsertOrMerge(o365Subnet.latest);
響應:參數 1:無法將“字符串”轉換為“Microsoft.WindowsAzure.Storage.Table.ITableEntity”
在 TableOperation.insertOrMerge(TableEntity entity) 方法中,實現 TableEntity 的TableEntity
實例與操作關聯。
首先,您需要有一個如下所示的TableEntity
:
public class DashboardApple : TableEntity
{
public string Latest{ get; set; }
public int ApplesCount { get; set; }
}
然后實例化表實體。
var dashboardApple = new DashboardApple
{
PartitionKey = "myPartition",
RowKey = "myRow",
Latest= "GoldenDelicious",
ApplesCount = 5
};
最后,將 tableentity 發送到InsertOrMerge
。
TableOperation tableOperation = TableOperation.InsertOrMerge(dashboardApple);
根據你的情況,可以設置Latest= o365Su.net.latest;
有關更多詳細信息,您可以參考這篇文章。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.