如何解决如何将字符串转换为Microsoft.WindowsAzure.Storage.Table.ITableEntity?
您好,感谢您提供的所有帮助! 我在更新我的天蓝色表时遇到问题,我不确定该怎么办 我在做什么: 1,将json解析为var 2.使用另一个创建该变量的实例测试= parsedJson.latest; 3.在表操作中使用该var(自动分配的字符串)来插入或替换表实体。使用的代码如下:
$settings = [System.Xml.XmlWriterSettings]@{
Encoding = $encoding
Indent = $true
NewLineOnAttributes = $true
}
$writer = [System.Xml.XmlWriter]::Create($filename,$settings)
# <?xml version="1.0" encoding="utf-8"?>
# <Config>
# <Group
# name="PropertyGroup">
# <Property
# id="1"
# value="Foo" />
# <Property
# id="2"
# value="Bar"
# exclude="false" />
# </Group>
# </Config>
响应:参数1:无法将'string'转换为'Microsoft.WindowsAzure.Storage.Table.ITableEntity'
解决方法
在TableOperation.insertOrMerge(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
};
最后,将表象信息发送到InsertOrMerge
。
TableOperation tableOperation = TableOperation.InsertOrMerge(dashboardApple);
根据您的情况,您可以设置Latest= o365Subnet.latest;
有关更多详细信息,请参阅此article。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。