Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 在windows azure中使用循环将批插入添加到表存储_Asp.net_Batch Processing_Azure Table Storage - Fatal编程技术网

Asp.net 在windows azure中使用循环将批插入添加到表存储

Asp.net 在windows azure中使用循环将批插入添加到表存储,asp.net,batch-processing,azure-table-storage,Asp.net,Batch Processing,Azure Table Storage,我正在尝试在Windows Azure中从对象列表批量插入表存储 我现在正在使用存储模拟器。 我得到这个错误: “操作的意外响应代码” 我试图寻找任何遇到类似问题的人,但没有结果 我的钥匙是这样设置的: PartitionKey = "projects" + CompanyID.toString(); RowKey = ProjectID.toString(); 它是这样插入的: foreach (vProject item in projectList) {

我正在尝试在Windows Azure中从对象列表批量插入表存储

我现在正在使用存储模拟器。 我得到这个错误:

“操作的意外响应代码”

我试图寻找任何遇到类似问题的人,但没有结果

我的钥匙是这样设置的:

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);
foreach(项目列表中的项目项)
{
TableOperation retrieveOperation=TableOperation.Retrieve(“项目”+CompanyID.toString(),item.ProjectID.toString());
TableResult retrievedResult=table.Execute(retrieveOperation);
if(retrievedResult.Result!=null)
{
mmMultipleSave.ViewProjectEntity updateEntity=(mmMultipleSave.ViewProjectEntity)retrievedResult.Result;
如果(!item.isProjectArchived)
{
//更新表存储中的实体
updateEntity.ProjectClient=item.ClientName;
updateEntity.ProjectCompany=项目公司;
updateEntity.ProjectName=item.ProjectName;
batchUpdateOperation.Replace(更新属性);
}
否则{
//如果项目在数据库中存档,则删除表存储中的项目
batchDeleteOperation.Delete(updateEntity);
}
}
else//如果表存储中不存在,则插入
{
mMultipleSave.ViewProjectEntity=新的mMultipleSave.ViewProjectEntity(CompanyID,item.ProjectID);
entity.ProjectClient=item.ClientName;
entity.ProjectCompany=项目公司;
entity.ProjectName=item.ProjectName;
batchInsertOperation.Insert(实体);
}
}
如果(batchInsertOperation.Count>0)
表.ExecuteBatch(batchInsertOperation);
如果(batchUpdateOperation.Count>0)
表.ExecuteBatch(batchUpdateOperation);
如果(batchDeleteOperation.Count>0)
表.ExecuteBatch(batchDeleteOperation);
它在
table.ExecuteBatch(batchInsertOperation)上获取错误


请帮忙

我已经解决了这个问题。将您的windows azure工具(包括emulator)更新至最新版本。到今天为止,它的版本是2.0