1
0
mirror of synced 2024-11-15 06:43:49 +00:00
Tapeti/Tapeti.Flow/FlowMiddleware.cs

32 lines
1.0 KiB
C#
Raw Normal View History

using System.Collections.Generic;
using Tapeti.Config;
using Tapeti.Flow.Default;
namespace Tapeti.Flow
{
public class FlowMiddleware : ITapetiExtension
{
2017-08-14 11:58:01 +00:00
private IFlowRepository flowRepository;
2017-08-14 11:58:01 +00:00
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.RegisterDefaultSingleton<IFlowRepository>(() => flowRepository ?? new NonPersistentFlowRepository());
container.RegisterDefaultSingleton<IFlowStore, FlowStore>();
}
public IEnumerable<object> GetMiddleware(IDependencyResolver dependencyResolver)
{
yield return new FlowBindingMiddleware();
yield return new FlowCleanupMiddleware();
}
}
}