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
|
|
|
|
|
{
|
2019-08-14 18:48:40 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Provides the Flow middleware.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class FlowExtension : ITapetiExtension
|
2017-01-31 11:01:08 +00:00
|
|
|
|
{
|
2022-11-23 08:13:38 +00:00
|
|
|
|
private readonly IFlowRepository? flowRepository;
|
2017-07-27 15:30:36 +00:00
|
|
|
|
|
2021-05-29 19:51:58 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// </summary>
|
2022-11-23 08:13:38 +00:00
|
|
|
|
public FlowExtension(IFlowRepository? flowRepository)
|
2017-07-27 15:30:36 +00:00
|
|
|
|
{
|
|
|
|
|
this.flowRepository = flowRepository;
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-14 18:48:40 +00:00
|
|
|
|
/// <inheritdoc />
|
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>();
|
2018-12-19 19:50:56 +00:00
|
|
|
|
container.RegisterDefaultSingleton(() => flowRepository ?? new NonPersistentFlowRepository());
|
2017-10-17 08:34:07 +00:00
|
|
|
|
container.RegisterDefaultSingleton<IFlowStore, FlowStore>();
|
2017-02-07 17:22:28 +00:00
|
|
|
|
}
|
2017-01-31 11:01:08 +00:00
|
|
|
|
|
2019-08-14 18:48:40 +00:00
|
|
|
|
/// <inheritdoc />
|
2017-02-07 17:22:28 +00:00
|
|
|
|
public IEnumerable<object> GetMiddleware(IDependencyResolver dependencyResolver)
|
|
|
|
|
{
|
2017-10-13 11:49:47 +00:00
|
|
|
|
yield return new FlowBindingMiddleware();
|
2017-01-31 11:01:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|