/// <summary> /// Initializes a new instance of the <see cref="AzureTableStorageCache"/> class. /// </summary> /// <param name="options">The options.</param> public AzureTableStorageCache([NotNull] IOptions <AzureTableStorageCacheOptions> options) { Guard.NotNull(options, nameof(options)); _options = options.Value; // Create CloudTableClient var client = CloudStorageAccount.Parse(_options.ConnectionString).CreateCloudTableClient(); // Create TableSet _tableSet = new TableSet <CachedItem>(client, _options.TableName); }
public static IServiceCollection AddDistributedAzureTableStorageCache([NotNull] this IServiceCollection services, Action <AzureTableStorageCacheOptions> configureAction) { Guard.NotNull(services, nameof(services)); Guard.NotNull(configureAction, nameof(configureAction)); var options = new AzureTableStorageCacheOptions(); configureAction(options); services.AddSingleton(Options.Options.Create(options)); services.AddSingleton <IDistributedCache, AzureTableStorageCache>(); return(services); }