// protected methods protected override BulkWriteBatchResult EmulateSingleRequest(MongoConnection connection, WriteRequest request, int originalIndex) { var serverInstance = connection.ServerInstance; var insertRequest = (InsertRequest)request; var insertRequests = new[] { insertRequest }; var operationArgs = new BulkInsertOperationArgs( _args.AssignId, _args.CheckElementNames, _args.CollectionName, _args.DatabaseName, 1, // maxBatchCount serverInstance.MaxMessageLength, // maxBatchLength serverInstance.MaxDocumentSize, serverInstance.MaxWireDocumentSize, true, // isOrdered _args.ReaderSettings, insertRequests, _args.WriteConcern, _args.WriterSettings); var operation = new InsertOpcodeOperation(operationArgs); WriteConcernResult writeConcernResult = null; WriteConcernException writeConcernException = null; try { var operationResult = operation.Execute(connection); if (operationResult != null) { writeConcernResult = operationResult.First(); } } catch (WriteConcernException ex) { writeConcernResult = ex.WriteConcernResult; writeConcernException = ex; } var indexMap = new IndexMap.RangeBased(0, originalIndex, 1); return BulkWriteBatchResult.Create( insertRequest, writeConcernResult, writeConcernException, indexMap); }
// protected methods protected override BulkWriteBatchResult EmulateSingleRequest(MongoConnection connection, WriteRequest request, int originalIndex) { var serverInstance = connection.ServerInstance; var insertRequest = (InsertRequest)request; var insertRequests = new[] { insertRequest }; var operationArgs = new BulkInsertOperationArgs( _args.AssignId, _args.CheckElementNames, _args.CollectionName, _args.DatabaseName, 1, // maxBatchCount serverInstance.MaxMessageLength, // maxBatchLength true, // isOrdered _args.ReaderSettings, insertRequests, _args.WriteConcern, _args.WriterSettings); var operation = new InsertOpcodeOperation(operationArgs); WriteConcernResult writeConcernResult = null; WriteConcernException writeConcernException = null; try { var operationResult = operation.Execute(connection); if (operationResult != null) { writeConcernResult = operationResult.First(); } } catch (WriteConcernException ex) { writeConcernResult = ex.WriteConcernResult; writeConcernException = ex; } var indexMap = new IndexMap.RangeBased(0, originalIndex, 1); return(BulkWriteBatchResult.Create( insertRequest, writeConcernResult, writeConcernException, indexMap)); }
// constructors public BulkInsertOperationEmulator(BulkInsertOperationArgs args) : base(args) { _args = args; }
// constructors public InsertOpcodeOperation(BulkInsertOperationArgs args) : base(args.DatabaseName, args.CollectionName, args.ReaderSettings, args.WriterSettings, args.WriteConcern) { _args = args; _continueOnError = !_args.IsOrdered; }
// constructors public InsertOpcodeOperationEmulator(BulkInsertOperationArgs args) { _args = args; }
// constructors public BulkInsertOperation(BulkInsertOperationArgs args) : base(args) { _args = args; }
// constructors public InsertBatchSerializer(BulkInsertOperationArgs args) : base(args) { _args = args; }