正如标题所说。使用Simple OData Client. 4.29.0
在OData批处理中插入超过一千条记录时,我无法修复上述错误我和来自MaxOperationsPerChangeset not working的人有同样的问题,除了我只使用OData V3。它仍然是快速7个月的答案,所以我试试我的运气,以防有人知道如何解决这个但错过了旧线程。我尝试在我的OData服务中设置MaxOperationsPerChangeset和MaxPartsPerBatch,如下所示。
ODataBatchHandler _batchHandler = new EntityFrameworkBatchHandler(GlobalConfiguration.DefaultServer);
_batchHandler.MessageQuotas.MaxOperationsPerChangeset = Int32.MaxValue;
_batchHandler.MessageQuotas.MaxPartsPerBatch = Int32.MaxValue;
conventions.Insert(0, new CompositeKeyRouting());
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
config.Routes.MapODataServiceRoute(
routeName: "odata",
routePrefix : null,
model: GetModel(),
pathHandler: new DefaultODataPathHandler(),
batchHandler : _batchHandler,
routingConventions: conventions);
在我的Simple OData Client中,我有这段代码
stkmupdateBatch += c => c
.For<stockmovement>()
.Filter(f => f.StoreCode == stkm.StoreCode && f.Refno == stkm.Refno)
.DeleteEntriesAsync();
IEnumerable<stockmovement> _movements = stockmovementClient.Where(s => s.StoreCode == stkm.StoreCode && s.Refno == stkm.Refno);
//6,140 records...
foreach (stockmovement stkmi in _movements)
{
stkmi.Migration = 0;
stkmupdateBatch += c => c
.For<stockmovement>()
.Set(stkmi)
.InsertEntryAsync();
}
try
{
await stkmupdateBatch.ExecuteAsync();
success = true;
}
我从Microsoft Forum读到他们已修复此错误,因此我不知道为什么会遇到此问题。
请注意,EntityFrameworkBatchHandler是我从EntityFrameworkBatchHandler下载的DefaultODataBatchHandler的扩展
任何输入都将受到高度赞赏。
提前谢谢