protected override Task <IHandlerInstance> RunAsync(Execution <HandleContext, IHandlerInstance> execution) { IServiceScope scope = ScopedMessageWorkflow.GetScope(execution.Context); IHandlerInstance handler = new DefaultHandlerInstance(scope.ServiceProvider.GetRequiredService(execution.Context.HandlerType)); return(Task.FromResult(handler)); }
public IWorkflow GetWorkflow() { var messageHandleWorkflow = new MessageHandleWorkflow(new CreateScopedHandlerWorkflow()); var scopedWorkflow = new ScopedMessageWorkflow(serviceProvider, messageHandleWorkflow, tenantResolver); messageHandleWorkflow.Finalize.Use(new ProjectionsWorkflow(x => ScopedMessageWorkflow.GetScope(x).ServiceProvider.GetRequiredService <IProjectionWriter>())); var projectionsWorkflow = new InMemoryRetryWorkflow <HandleContext>(scopedWorkflow); return(projectionsWorkflow); }
protected override IHandlerInstance Run(Execution <HandleContext, IHandlerInstance> execution) { IServiceScope scope = ScopedMessageWorkflow.GetScope(execution.Context); return(new DefaultHandlerInstance(scope.ServiceProvider.GetRequiredService(execution.Context.HandlerType))); }