2019-01-05 11:50:08 +00:00
|
|
|
using Elsa.Activities.Http.Descriptors;
|
|
|
|
|
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 11:50:08 +00:00
|
|
|
public static IServiceCollection AddHttpDescriptors(this IServiceCollection services)
|
|
|
|
|
{
|
|
|
|
|
return services.AddActivityDescriptor<HttpRequestTriggerDescriptor>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IServiceCollection AddHttpDrivers(this IServiceCollection services)
|
2018-12-30 17:20:12 +00:00
|
|
|
{
|
|
|
|
|
services
|
|
|
|
|
.AddSingleton<IHttpWorkflowCache, DefaultHttpWorkflowCache>()
|
|
|
|
|
.AddAsyncInitializer<HttpWorkflowCacheInitializer>()
|
2019-01-05 11:50:08 +00:00
|
|
|
.AddActivityDriver<HttpRequestTriggerDriver>();
|
2018-12-30 17:20:12 +00:00
|
|
|
|
|
|
|
|
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|