Flow repository kan worden meegegeven bij de WithFlow() configuratie
This commit is contained in:
parent
8d069e1c48
commit
c79d7eec4f
@ -2,9 +2,9 @@
|
||||
{
|
||||
public static class ConfigExtensions
|
||||
{
|
||||
public static TapetiConfig WithFlow(this TapetiConfig config)
|
||||
public static TapetiConfig WithFlow(this TapetiConfig config, IFlowRepository<Default.FlowState> flowRepository)
|
||||
{
|
||||
config.Use(new FlowMiddleware());
|
||||
config.Use(new FlowMiddleware(flowRepository));
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
@ -6,12 +6,19 @@ namespace Tapeti.Flow
|
||||
{
|
||||
public class FlowMiddleware : ITapetiExtension
|
||||
{
|
||||
private IFlowRepository<Default.FlowState> flowRepository;
|
||||
|
||||
public FlowMiddleware(IFlowRepository<Default.FlowState> flowRepository)
|
||||
{
|
||||
this.flowRepository = flowRepository;
|
||||
}
|
||||
|
||||
public void RegisterDefaults(IDependencyContainer container)
|
||||
{
|
||||
container.RegisterDefault<IFlowProvider, FlowProvider>();
|
||||
container.RegisterDefault<IFlowStarter, FlowStarter>();
|
||||
container.RegisterDefault<IFlowHandler, FlowProvider>();
|
||||
container.RegisterDefault<IFlowRepository<FlowState>, NonPersistentFlowRepository<FlowState>>();
|
||||
container.RegisterDefault<IFlowRepository<FlowState>>(() => flowRepository ?? new NonPersistentFlowRepository<Default.FlowState>());
|
||||
container.RegisterDefault<IFlowStore, FlowStore>();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user