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>();
        }
        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);
 }