asp.net - Batch Insert using a loop to add to table storage in windows azure -
i trying batch insert list of objects table storage in windows azure. using storage emulator now. error "unexpected response code operation". tried search encountered similar problems no avail.
my keys setup way: partitionkey = "projects" + companyid.tostring(); rowkey = projectid.tostring();
it inserted this: foreach (vproject item in projectlist) { tableoperation retrieveoperation = tableoperation.retrieve("projects" + companyid.tostring(), item.projectid.tostring());
tableresult retrievedresult = table.execute(retrieveoperation); if (retrievedresult.result != null) { mmultiplesave.viewprojectentity updateentity = (mmultiplesave.viewprojectentity)retrievedresult.result; if (!item.isprojectarchived) { //update entity in table storage updateentity.projectclient = item.clientname; updateentity.projectcompany = item.company; updateentity.projectname = item.projectname; batchupdateoperation.replace(updateentity); } else { //delete project in table storage if archived in database batchdeleteoperation.delete(updateentity); } } else //if not exist in table storage insert { mmultiplesave.viewprojectentity entity = new mmultiplesave.viewprojectentity(companyid, item.projectid); entity.projectclient = item.clientname; entity.projectcompany = item.company; entity.projectname = item.projectname; batchinsertoperation.insert(entity); } } if (batchinsertoperation.count > 0) table.executebatch(batchinsertoperation); if (batchupdateoperation.count > 0) table.executebatch(batchupdateoperation); if (batchdeleteoperation.count > 0) table.executebatch(batchdeleteoperation);
it gets error on table.executebatch(batchinsertoperation);
please help. thank you.
i have solved problem. update windows azure tools including emulator latest version. of today, in version 2.0
Comments
Post a Comment