// protected methods protected override BulkWriteBatchResult EmulateSingleRequest(MongoConnection connection, WriteRequest request, int originalIndex) { var serverInstance = connection.ServerInstance; var deleteRequest = (DeleteRequest)request; var deleteRequests = new[] { deleteRequest }; var operationArgs = new BulkDeleteOperationArgs( _args.CollectionName, _args.DatabaseName, 1, // maxBatchCount serverInstance.MaxMessageLength, // maxBatchLength serverInstance.MaxDocumentSize, serverInstance.MaxWireDocumentSize, true, // isOrdered _args.ReaderSettings, deleteRequests, _args.WriteConcern, _args.WriterSettings); var operation = new DeleteOpcodeOperation(operationArgs); WriteConcernResult writeConcernResult; WriteConcernException writeConcernException = null; try { writeConcernResult = operation.Execute(connection); } catch (WriteConcernException ex) { writeConcernResult = ex.WriteConcernResult; writeConcernException = ex; } var indexMap = new IndexMap.RangeBased(0, originalIndex, 1); return(BulkWriteBatchResult.Create( deleteRequest, writeConcernResult, writeConcernException, indexMap)); }
// protected methods protected override BulkWriteBatchResult EmulateSingleRequest(MongoConnection connection, WriteRequest request, int originalIndex) { var serverInstance = connection.ServerInstance; var deleteRequest = (DeleteRequest)request; var deleteRequests = new[] { deleteRequest }; var operationArgs = new BulkDeleteOperationArgs( _args.CollectionName, _args.DatabaseName, 1, // maxBatchCount serverInstance.MaxMessageLength, // maxBatchLength serverInstance.MaxDocumentSize, serverInstance.MaxWireDocumentSize, true, // isOrdered _args.ReaderSettings, deleteRequests, _args.WriteConcern, _args.WriterSettings); var operation = new DeleteOpcodeOperation(operationArgs); WriteConcernResult writeConcernResult; WriteConcernException writeConcernException = null; try { writeConcernResult = operation.Execute(connection); } catch (WriteConcernException ex) { writeConcernResult = ex.WriteConcernResult; writeConcernException = ex; } var indexMap = new IndexMap.RangeBased(0, originalIndex, 1); return BulkWriteBatchResult.Create( deleteRequest, writeConcernResult, writeConcernException, indexMap); }
// constructors public DeleteOpcodeOperation(BulkDeleteOperationArgs args) : base(args.DatabaseName, args.CollectionName, args.ReaderSettings, args.WriterSettings, args.WriteConcern) { _args = args; }
// constructors public DeleteOpcodeOperationEmulator(BulkDeleteOperationArgs args) { _args = args; }
// constructors public BulkDeleteOperation(BulkDeleteOperationArgs args) : base(args) { _args = args; }
// constructors public DeleteBatchSerializer(BulkDeleteOperationArgs args) : base(args) { _args = args; }