public static async Task ExecuteAfterRequestCallbacks(IServiceProvider serviceProvider, ISaga saga, Exception ex) { var scopeFactory = serviceProvider.GetRequiredService <IServiceScopeFactory>(); using var scope = scopeFactory.CreateScope(); using var beforeStartCallbackExecuter = new AfterRequestCallbackExecuter( afterRequestCallbacks, scope.ServiceProvider, ex); MiddlewaresChain middlewaresChain = Middlewares.BuildSimpleChain( scope.ServiceProvider, beforeStartCallbackExecuter.Execute); await Middlewares.ExecuteChain( middlewaresChain, saga, null, null); }
public static void AddAfterExecuteMiddlewares <T>( this ITheSagaConfig config) where T : ISagaMiddleware { Middlewares.AddAfterExecuteMiddlewares <T>(); }