c# - TableStorage.ReplaceUpdateEntity -
there method replaceupdateentity
object of tablestorage
used in azurestorage
section. tried googling of might or example. brief description or link pointing towards welcome.
tablestoragetestentity tablestoragetestentity = new tablestoragetestentity() { tableid = guid.newguid(), tablepurpose = "updateentity" }; string partitionkey = "31072015"; string rowkey = "0108201551"; bool result = this.tablestorage.replaceupdateentity(this.tablename, partitionkey, rowkey, tablestoragetestentity); assert.istrue(result);
actually running test , test fails. understand method.
the method you're looking insertorreplace
. operation create entity if not exist otherwise update entity replacing of attributes new values. here's sample code:
var account = new cloudstorageaccount(new storagecredentials(accountname, accountkey), true); var tableclient = account.createcloudtableclient(); var table = tableclient.gettablereference("address"); var entity = new dynamictableentity("pk", "rk"); entity.properties.add("attribute1", new entityproperty("attribute 1 value")); tableoperation upsertoperation = tableoperation.insertorreplace(entity); table.execute(upsertoperation);
Comments
Post a Comment