public static void UseSqlServer( this ConcurrencyOptionsBuilder concurrencyOptionsBuilder, Action <SqlServerCacheOptions> callback) { if (callback == null) { throw new ArgumentNullException(nameof(callback)); } var options = new SqlServerCacheOptions(); callback(options); UseSqlServer(concurrencyOptionsBuilder, options); }
public static void UseSqlServer( this ConcurrencyOptionsBuilder concurrencyOptionsBuilder, SqlServerCacheOptions options) { if (concurrencyOptionsBuilder == null) { throw new ArgumentNullException(nameof(concurrencyOptionsBuilder)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } concurrencyOptionsBuilder.ConcurrencyOptions.Storage = new SqlServerStorage(options); }
public static IServiceCollection AddConcurrency( this IServiceCollection serviceCollection, Action <ConcurrencyOptionsBuilder> callback) { if (serviceCollection == null) { throw new ArgumentNullException(nameof(serviceCollection)); } if (callback == null) { throw new ArgumentNullException(nameof(callback)); } var builder = new ConcurrencyOptionsBuilder(); callback(builder); serviceCollection.AddSingleton(builder.ConcurrencyOptions); serviceCollection.AddTransient <IConcurrencyManager, ConcurrencyManager>(); serviceCollection.AddTransient <IRepresentationManager, RepresentationManager>(); return(serviceCollection); }