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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -