2017-02-07 16:13:33 +01:00
|
|
|
|
using System.Collections.Generic;
|
2017-01-31 12:01:08 +01:00
|
|
|
|
using Tapeti.Config;
|
|
|
|
|
using Tapeti.Flow.Default;
|
|
|
|
|
|
|
|
|
|
namespace Tapeti.Flow
|
|
|
|
|
{
|
2017-02-07 18:22:28 +01:00
|
|
|
|
public class FlowMiddleware : ITapetiExtension
|
2017-01-31 12:01:08 +01:00
|
|
|
|
{
|
2018-12-19 20:50:56 +01:00
|
|
|
|
private readonly IFlowRepository flowRepository;
|
2017-07-27 17:30:36 +02:00
|
|
|
|
|
2017-08-14 13:58:01 +02:00
|
|
|
|
public FlowMiddleware(IFlowRepository flowRepository)
|
2017-07-27 17:30:36 +02:00
|
|
|
|
{
|
|
|
|
|
this.flowRepository = flowRepository;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-07 18:22:28 +01:00
|
|
|
|
public void RegisterDefaults(IDependencyContainer container)
|
2017-01-31 12:01:08 +01:00
|
|
|
|
{
|
2017-02-07 18:22:28 +01:00
|
|
|
|
container.RegisterDefault<IFlowProvider, FlowProvider>();
|
2017-02-15 22:05:01 +01:00
|
|
|
|
container.RegisterDefault<IFlowStarter, FlowStarter>();
|
2017-02-07 18:22:28 +01:00
|
|
|
|
container.RegisterDefault<IFlowHandler, FlowProvider>();
|
2018-12-19 20:50:56 +01:00
|
|
|
|
container.RegisterDefaultSingleton(() => flowRepository ?? new NonPersistentFlowRepository());
|
2017-10-17 10:34:07 +02:00
|
|
|
|
container.RegisterDefaultSingleton<IFlowStore, FlowStore>();
|
2017-02-07 18:22:28 +01:00
|
|
|
|
}
|
2017-01-31 12:01:08 +01:00
|
|
|
|
|
2017-02-07 18:22:28 +01:00
|
|
|
|
public IEnumerable<object> GetMiddleware(IDependencyResolver dependencyResolver)
|
|
|
|
|
{
|
2017-10-13 13:49:47 +02:00
|
|
|
|
yield return new FlowBindingMiddleware();
|
|
|
|
|
yield return new FlowCleanupMiddleware();
|
2017-01-31 12:01:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|