2019-10-31 20:31:18 +00:00
|
|
|
using Elsa.Extensions;
|
2019-11-21 10:39:11 +00:00
|
|
|
using Elsa.Scripting.JavaScript.Options;
|
2019-10-27 14:38:37 +00:00
|
|
|
using Elsa.Scripting.JavaScript.Services;
|
2019-11-21 10:39:11 +00:00
|
|
|
using System;
|
2020-01-16 20:23:45 +00:00
|
|
|
using Elsa.Expressions;
|
2019-10-27 14:38:37 +00:00
|
|
|
|
2019-11-23 07:21:20 +00:00
|
|
|
// ReSharper disable once CheckNamespace
|
|
|
|
|
namespace Microsoft.Extensions.DependencyInjection
|
2019-10-27 14:38:37 +00:00
|
|
|
{
|
|
|
|
|
public static class JavaScriptServiceCollectionExtensions
|
|
|
|
|
{
|
|
|
|
|
public static IServiceCollection AddJavaScriptExpressionEvaluator(this IServiceCollection services)
|
|
|
|
|
{
|
|
|
|
|
return services
|
2020-01-16 20:23:45 +00:00
|
|
|
.TryAddProvider<IExpressionHandler, JavaScriptHandler>(ServiceLifetime.Scoped)
|
2020-10-11 12:33:18 +00:00
|
|
|
.AddNotificationHandlers(typeof(JavaScriptServiceCollectionExtensions));
|
2019-10-27 14:38:37 +00:00
|
|
|
}
|
2019-11-21 10:39:11 +00:00
|
|
|
|
2020-10-27 11:32:53 +00:00
|
|
|
public static IServiceCollection WithJavaScriptOptions(this IServiceCollection services, Action<ScriptOptions> configureOptions)
|
2019-11-21 10:39:11 +00:00
|
|
|
{
|
2020-10-27 11:32:53 +00:00
|
|
|
services.Configure(configureOptions);
|
2019-11-21 22:07:06 +00:00
|
|
|
|
2019-11-21 10:39:11 +00:00
|
|
|
return services;
|
|
|
|
|
}
|
2019-10-27 14:38:37 +00:00
|
|
|
}
|
|
|
|
|
}
|