Пример #1
0
 public static DistributedLockingOptionsBuilder UseRedisLockProvider(this DistributedLockingOptionsBuilder options, string connectionString)
 {
     options.UseProviderFactory(sp =>
     {
         var connectionMultiplexer = sp.GetRequiredService <IConnectionMultiplexer>();
         var database = connectionMultiplexer.GetDatabase();
         return(name => new RedisDistributedLock(name, database));
     });
     return(options);
 }
        public static DistributedLockingOptionsBuilder UseRedisLockProvider(this DistributedLockingOptionsBuilder options, string connectionString)
        {
            options
            .Services
            .UseStackExchangeConnectionMultiplexer(connectionString)
            .UseRedLockFactory();

            options.UseProviderFactory(CreateRedisDistributedLockFactory);

            return(options);
        }
Пример #3
0
        public ElsaOptionsBuilder(IServiceCollection services)
        {
            ElsaOptions = new ElsaOptions();
            Services    = services;

            AddAutoMapper = () =>
            {
                // The profiles are added to AddWorkflowsCore so that they are not forgotten in case the AddAutoMapper function(option) is overridden.
                services.AddAutoMapper(Enumerable.Empty <Assembly>(), ServiceLifetime.Singleton);
            };

            services.AddSingleton <InMemNetwork>();
            services.AddSingleton <InMemorySubscriberStore>();
            services.AddSingleton <InMemDataStore>();
            services.AddMemoryCache();

            DistributedLockingOptionsBuilder = new DistributedLockingOptionsBuilder(this);
        }
Пример #4
0
 public static DistributedLockingOptionsBuilder UseAzureBlobLockProvider(this DistributedLockingOptionsBuilder options, Uri blobContainerUrl)
 {
     options.UseProviderFactory(sp => CreateAzureDistributedLockFactory(sp, blobContainerUrl));
     return(options);
 }
 public static DistributedLockingOptionsBuilder UseSqlServerLockProvider(this DistributedLockingOptionsBuilder options, string connectionString)
 {
     options.UseProviderFactory(sp => name => new SqlDistributedLock(name, connectionString));
     return(options);
 }