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)); }); }
public static void AddAfterRequestCallback <T>( this ITheSagaConfig config) where T : ISagaAfterRequestCallback { Callbacks.AddAfterRequestCallback <T>(); }
public static void AddAfterExecuteMiddlewares <T>( this ITheSagaConfig config) where T : ISagaMiddleware { Middlewares.AddAfterExecuteMiddlewares <T>(); }
public static void UseFilePersistance(this ITheSagaConfig config) { config.Services.AddTransient <ISagaPersistance, InFileSagaPersistance>(); }
public static ITheSagaConfig AddModelDefinitions( this ITheSagaConfig config) { config.Services.AddSagaModelDefinitions(); return(config); }