Hi thanks in advance for all the help: I'm having a problem updating my azure table and i'm not sure what to do what im doing. 1.Parsing a json to a var 2.creating an instance of that var with another eg test = parsedJson;latest. 3. using that var (auto assigned string) with a table operation to insert or replace a table entity: The code used is below:
var o365Subnet = JsonConvert.DeserializeObject<ConvertJson>(o365Latest);
var o365Final = o365Subnet.latest;
TableOperation tableOperation = TableOperation.InsertOrMerge(o365Subnet.latest);
Response: Argument 1: Cannot convert 'string' to 'Microsoft.WindowsAzure.Storage.Table.ITableEntity'
In TableOperation.insertOrMerge(TableEntity entity) Method, the object instance implementing TableEntity
to associate with the operation.
First, you need have a TableEntity
like below:
public class DashboardApple : TableEntity
{
public string Latest{ get; set; }
public int ApplesCount { get; set; }
}
Then instantiate the table entity.
var dashboardApple = new DashboardApple
{
PartitionKey = "myPartition",
RowKey = "myRow",
Latest= "GoldenDelicious",
ApplesCount = 5
};
Finally, send the tableentity to InsertOrMerge
.
TableOperation tableOperation = TableOperation.InsertOrMerge(dashboardApple);
According to your situation, you can set Latest= o365Su.net.latest;
For more details, you could refer to this article .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.