/// <summary> /// Set the batch operation type or throw if not allowed. /// </summary> /// <param name="operationType"> /// The type of operation to perform. /// </param> private void SetBatchOperationType(BlobBatchOperationType operationType) { if (Submitted) { throw BatchErrors.BatchAlreadySubmitted(); } else if (_operationType != null && _operationType != operationType) { throw BatchErrors.OnlyHomogenousOperationsAllowed(_operationType.Value); } _operationType = operationType; }
public static InvalidOperationException OnlyHomogenousOperationsAllowed(BlobBatchOperationType operationType) => new InvalidOperationException($"{nameof(BlobBatch)} only supports one operation type per batch and is already being used for {operationType} operations.");