コード例 #1
0
        public static void UseDistributedLock(this ITheSagaConfig config, SqlServerLockingOptions options)
        {
            if (string.IsNullOrEmpty(options?.ConnectionString))
            {
                throw new Exception($"ConnectionString for TheSaga.Locking.DistributedLock cannot be empty");
            }

            config.Services.AddSingleton <SqlServerLockingOptions>(ctx => options);
            config.Services.AddSingleton <ISagaLocking, SagaDistributedLocking>();
        }
コード例 #2
0
        public static void UseSqlServer(this ITheSagaConfig config, SqlServerOptions options)
        {
            if (string.IsNullOrEmpty(options?.ConnectionString))
            {
                throw new Exception($"ConnectionString for TheSaga.Persistance.SqlServer cannot be empty");
            }

            config.Services.AddSingleton <SqlServerOptions>(ctx => options);
            config.Services.AddTransient <ISagaPersistance, SqlServerSagaPersistance>();
            config.Services.AddTransient <ISqlServerConnection>(ctx =>
            {
                return(new SqlServerConnection(options.ConnectionString));
            });
        }
コード例 #3
0
 public static void AddAfterRequestCallback <T>(
     this ITheSagaConfig config)
     where T : ISagaAfterRequestCallback
 {
     Callbacks.AddAfterRequestCallback <T>();
 }
コード例 #4
0
 public static void AddAfterExecuteMiddlewares <T>(
     this ITheSagaConfig config)
     where T : ISagaMiddleware
 {
     Middlewares.AddAfterExecuteMiddlewares <T>();
 }
コード例 #5
0
 public static void UseFilePersistance(this ITheSagaConfig config)
 {
     config.Services.AddTransient <ISagaPersistance, InFileSagaPersistance>();
 }
コード例 #6
0
 public static ITheSagaConfig AddModelDefinitions(
     this ITheSagaConfig config)
 {
     config.Services.AddSagaModelDefinitions();
     return(config);
 }