2019-01-05 11:50:08 +00:00
|
|
|
using Elsa.Activities.Http.Drivers;
|
|
|
|
|
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.AddAsyncInitialization();
|
2018-12-30 17:20:12 +00:00
|
|
|
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
2019-01-05 13:19:12 +00:00
|
|
|
|
2019-01-20 17:16:57 +00:00
|
|
|
services
|
|
|
|
|
.AddActivityDriver<HttpRequestTriggerDriver>()
|
|
|
|
|
.AddActivityDriver<HttpResponseActionDriver>();
|
|
|
|
|
|
2018-12-30 17:20:12 +00:00
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|