// private methods private void AddRequest(WriteRequest request) { if (_hasBeenExecuted) { throw new InvalidOperationException("The bulk write operation has already been executed."); } _requests.Add(request); }
// static methods // These static methods are only called from the Legacy // API, so there is type safety in how they got allowed // into the system, meaning that even though // some things below seem unsafe, they are in a roundabout // way. In addition, we know that there will always // be one level of BsonDocumentWrapper for everything, even // when the type is already a BsonDocument :(. internal static WriteModel <TDocument> FromCore(WriteRequest request) { switch (request.RequestType) { case WriteRequestType.Delete: return(ConvertDeleteRequest((DeleteRequest)request)); case WriteRequestType.Insert: return(ConvertInsertRequest((InsertRequest)request)); case WriteRequestType.Update: return(ConvertUpdateRequest((UpdateRequest)request)); default: throw new NotSupportedException(); } }
// private methods private void AddRequest(WriteRequest request) { _requests.Add(request); }