2017-02-07 15:13:33 +00:00
|
|
|
|
using System.Collections.Generic;
|
2017-01-31 11:01:08 +00:00
|
|
|
|
using Tapeti.Config;
|
|
|
|
|
using Tapeti.Flow.Default;
|
|
|
|
|
|
|
|
|
|
namespace Tapeti.Flow
|
|
|
|
|
{
|
2017-02-07 17:22:28 +00:00
|
|
|
|
public class FlowMiddleware : ITapetiExtension
|
2017-01-31 11:01:08 +00:00
|
|
|
|
{
|
2017-07-27 15:30:36 +00:00
|
|
|
|
private IFlowRepository<Default.FlowState> flowRepository;
|
|
|
|
|
|
|
|
|
|
public FlowMiddleware(IFlowRepository<Default.FlowState> flowRepository)
|
|
|
|
|
{
|
|
|
|
|
this.flowRepository = flowRepository;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-07 17:22:28 +00:00
|
|
|
|
public void RegisterDefaults(IDependencyContainer container)
|
2017-01-31 11:01:08 +00:00
|
|
|
|
{
|
2017-02-07 17:22:28 +00:00
|
|
|
|
container.RegisterDefault<IFlowProvider, FlowProvider>();
|
2017-02-15 21:05:01 +00:00
|
|
|
|
container.RegisterDefault<IFlowStarter, FlowStarter>();
|
2017-02-07 17:22:28 +00:00
|
|
|
|
container.RegisterDefault<IFlowHandler, FlowProvider>();
|
2017-07-27 15:30:36 +00:00
|
|
|
|
container.RegisterDefault<IFlowRepository<FlowState>>(() => flowRepository ?? new NonPersistentFlowRepository<Default.FlowState>());
|
2017-02-07 17:22:28 +00:00
|
|
|
|
container.RegisterDefault<IFlowStore, FlowStore>();
|
|
|
|
|
}
|
2017-01-31 11:01:08 +00:00
|
|
|
|
|
2017-02-07 17:22:28 +00:00
|
|
|
|
public IEnumerable<object> GetMiddleware(IDependencyResolver dependencyResolver)
|
|
|
|
|
{
|
2017-01-31 11:01:08 +00:00
|
|
|
|
return new[] { new FlowBindingMiddleware() };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|