public async Task <T> Execute <T>(Func <SagaRepositoryContext <TSaga>, Task <T> > asyncMethod, CancellationToken cancellationToken = default) where T : class { var database = _databaseFactory(); var databaseContext = new AzureTableDatabaseContext <TSaga>(database, _keyFormatter); var repositoryContext = new CosmosTableSagaRepositoryContext <TSaga>(databaseContext, cancellationToken); return(await asyncMethod(repositoryContext).ConfigureAwait(false)); }
public async Task Send <T>(ConsumeContext <T> context, IPipe <SagaRepositoryContext <TSaga, T> > next) where T : class { var database = _databaseFactory(); var databaseContext = new AzureTableDatabaseContext <TSaga>(database, _keyFormatter); var repositoryContext = new AzureTableSagaRepositoryContext <TSaga, T>(databaseContext, context, _factory); await next.Send(repositoryContext).ConfigureAwait(false); }