1
0
mirror of synced 2024-11-16 06:43:51 +00:00
Tapeti/Tapeti.Flow/FlowMiddleware.cs
2017-08-14 13:58:01 +02:00

31 lines
1000 B
C#

using System.Collections.Generic;
using Tapeti.Config;
using Tapeti.Flow.Default;
namespace Tapeti.Flow
{
public class FlowMiddleware : ITapetiExtension
{
private IFlowRepository flowRepository;
public FlowMiddleware(IFlowRepository flowRepository)
{
this.flowRepository = flowRepository;
}
public void RegisterDefaults(IDependencyContainer container)
{
container.RegisterDefault<IFlowProvider, FlowProvider>();
container.RegisterDefault<IFlowStarter, FlowStarter>();
container.RegisterDefault<IFlowHandler, FlowProvider>();
container.RegisterDefault<IFlowRepository>(() => flowRepository ?? new NonPersistentFlowRepository());
container.RegisterDefault<IFlowStore, FlowStore>();
}
public IEnumerable<object> GetMiddleware(IDependencyResolver dependencyResolver)
{
return new[] { new FlowBindingMiddleware() };
}
}
}