using System; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Caching.DynamoDb; namespace Microsoft.Extensions.DependencyInjection { public static class DynamoDbCacheServiceCollectionExtensions { /// /// Adds Amazon DynamoDB caching services to the specified . /// /// The to add services to. /// An to configure the provided /// . /// The so that additional calls can be chained. public static IServiceCollection AddDistributedDynamoDbCache(this IServiceCollection services, Action setupAction) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (setupAction == null) { throw new ArgumentNullException(nameof(setupAction)); } services.AddOptions(); services.Configure(setupAction); services.Add(ServiceDescriptor.Singleton()); return services; } } }