/// <summary> /// Add Snoozle with an in-memory data provider to your application. /// </summary> /// <param name="configurationSection">A configuration section representing the <see cref="InMemorySnoozleOptions"/>.</param> public static IMvcBuilder AddSnoozleInMemory(this IMvcBuilder @this, IConfigurationSection configurationSection) { IServiceCollection serviceCollection = @this.Services; IInMemoryRuntimeConfigurationProvider runtimeConfigurationProvider = BuildRuntimeConfigurationProvider(); serviceCollection.Configure <InMemorySnoozleOptions>(options => configurationSection.Bind(options)); AddSnoozleInMemory(serviceCollection, runtimeConfigurationProvider); @this.AddSnoozleCore(runtimeConfigurationProvider, configurationSection); return(@this); }
/// <summary> /// Add Snoozle with an in-memory data provider to your application. /// </summary> /// <param name="optionsBuilder">A builder used to setup the <see cref="InMemorySnoozleOptions"/>.</param> public static IMvcBuilder AddSnoozleInMemory(this IMvcBuilder @this, Action <InMemorySnoozleOptions> optionsBuilder) { IServiceCollection serviceCollection = @this.Services; IInMemoryRuntimeConfigurationProvider runtimeConfigurationProvider = BuildRuntimeConfigurationProvider(); serviceCollection.Configure(optionsBuilder); AddSnoozleInMemory(serviceCollection, runtimeConfigurationProvider); @this.AddSnoozleCore(runtimeConfigurationProvider, optionsBuilder); return(@this); }
private static IServiceCollection AddSnoozleInMemory(this IServiceCollection @this, IInMemoryRuntimeConfigurationProvider runtimeConfigurationProvider) { @this.AddScoped <IDataProvider, InMemoryDataProvider>(); @this.AddSingleton(runtimeConfigurationProvider); return(@this); }
public InMemoryDataProvider(IInMemoryRuntimeConfigurationProvider inMemoryRuntimeConfigurationProvider) { _inMemoryRuntimeConfigurationProvider = inMemoryRuntimeConfigurationProvider; }