public Task <IPutBlobStrategy> CreateStrategyAsync(StorageStrategyDefinition strategyDefinition) { ValidateStrategyDefinition(strategyDefinition); if (strategyDictionary.ContainsKey(strategyDefinition.StrategyName)) { var strategy = strategyDictionary[strategyDefinition.StrategyName](strategyDefinition.StrategyConfiguration); return(Task.FromResult(strategy as IPutBlobStrategy)); } throw new NotSupportedException($"Put blob strategy [{strategyDefinition.StrategyName}] is not supported."); }
public void ValidateStrategyDefinition(StorageStrategyDefinition strategyDefinition) { if (strategyDefinition == null) { throw new ArgumentNullException(nameof(strategyDefinition)); } if (string.IsNullOrEmpty(strategyDefinition.StrategyName)) { throw new ArgumentException($"[{nameof(strategyDefinition.StrategyName)}] is required.", nameof(strategyDefinition)); } if (strategyDefinition.StrategyConfiguration == null) { throw new ArgumentException($"[{nameof(strategyDefinition.StrategyConfiguration)}] is required.", nameof(strategyDefinition)); } }