0
我试图从Windows Azure的对象表存储列表做批量插入。批量插入添加到表存储在Windows Azure中
我使用存储模拟器现在。 我得到这个错误:
"Unexpected response code for operation".
我试图寻找谁遇到过类似问题的人,但无济于事。
我的键设置是这样的:
PartitionKey = "projects" + CompanyID.toString();
RowKey = ProjectID.toString();
它插入这样的:
foreach (vProject item in projectList)
{
TableOperation retrieveOperation = TableOperation.Retrieve<mMultipleSave.ViewProjectEntity>("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 it is archived in the database
batchDeleteOperation.Delete(updateEntity);
}
}
else //if it does 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);
沾到table.ExecuteBatch(batchInsertOperation);
请帮助错误。