2019-01-05 13:19:12 +00:00
|
|
|
using AspNetCore.AsyncInitialization;
|
2019-01-05 11:50:08 +00:00
|
|
|
using Elsa.Activities.Http.Drivers;
|
2018-12-31 09:59:35 +00:00
|
|
|
using Elsa.Activities.Http.Initialization;
|
|
|
|
|
using Elsa.Activities.Http.Services;
|
|
|
|
|
using Elsa.Activities.Http.Services.Implementations;
|
2019-01-05 11:50:08 +00:00
|
|
|
using Elsa.Extensions;
|
2018-12-30 17:20:12 +00:00
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
|
|
|
|
|
2018-12-31 09:59:35 +00:00
|
|
|
namespace Elsa.Activities.Http.Extensions
|
2018-12-30 17:20:12 +00:00
|
|
|
{
|
|
|
|
|
public static class ServiceCollectionExtensions
|
|
|
|
|
{
|
2019-01-05 13:19:12 +00:00
|
|
|
public static IServiceCollection AddHttpWorkflowDescriptors(this IServiceCollection services)
|
2019-01-05 11:50:08 +00:00
|
|
|
{
|
2019-01-05 13:10:44 +00:00
|
|
|
return services.AddActivityDescriptors<ActivityDescriptors>();
|
2019-01-05 11:50:08 +00:00
|
|
|
}
|
2018-12-30 17:20:12 +00:00
|
|
|
|
2019-01-05 13:19:12 +00:00
|
|
|
public static IServiceCollection AddHttpWorkflowDrivers(this IServiceCollection services)
|
|
|
|
|
{
|
2019-01-05 15:05:47 +00:00
|
|
|
services.AddHttpWorkflowDescriptors();
|
2019-01-05 13:19:12 +00:00
|
|
|
services.TryAddSingleton<IHttpWorkflowCache, DefaultHttpWorkflowCache>();
|
|
|
|
|
services.AddAsyncInitialization();
|
|
|
|
|
services.TryAddTransient<IAsyncInitializer, HttpWorkflowCacheInitializer>();
|
|
|
|
|
services.AddActivityDriver<HttpRequestTriggerDriver>();
|
2018-12-30 17:20:12 +00:00
|
|
|
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
2019-01-05 13:19:12 +00:00
|
|
|
|
2018-12-30 17:20:12 +00:00
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|