| | | 1 | | using Elsa.Expressions.JavaScript.TypeDefinitions.Contracts; |
| | | 2 | | using Microsoft.Extensions.DependencyInjection; |
| | | 3 | | |
| | | 4 | | namespace Elsa.Expressions.JavaScript.Extensions; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Provides extension methods for <see cref="IServiceCollection"/>. |
| | | 8 | | /// </summary> |
| | | 9 | | public static class DependencyInjectionExtensions |
| | | 10 | | { |
| | | 11 | | /// <summary> |
| | | 12 | | /// Adds a <see cref="IFunctionDefinitionProvider"/> to the service collection. |
| | | 13 | | /// </summary> |
| | | 14 | | /// <param name="services">The service collection.</param> |
| | | 15 | | /// <typeparam name="T">The type of the function definition provider.</typeparam> |
| | | 16 | | /// <returns>The service collection.</returns> |
| | 940 | 17 | | public static IServiceCollection AddFunctionDefinitionProvider<T>(this IServiceCollection services) where T: class, |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Adds a <see cref="IFunctionDefinitionProvider"/> to the service collection. |
| | | 21 | | /// </summary> |
| | | 22 | | /// <param name="services">The service collection.</param> |
| | | 23 | | /// <param name="factory">A callback to create the function definition provider.</param> |
| | | 24 | | /// <typeparam name="T">The type of the function definition provider.</typeparam> |
| | | 25 | | /// <returns>The service collection.</returns> |
| | | 26 | | public static IServiceCollection AddFunctionDefinitionProvider<T>(this IServiceCollection services, Func<IServicePro |
| | 0 | 27 | | services.AddScoped<IFunctionDefinitionProvider, T>(factory); |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Adds a <see cref="ITypeDefinitionProvider"/> to the service collection. |
| | | 31 | | /// </summary> |
| | | 32 | | /// <param name="services">The service collection.</param> |
| | | 33 | | /// <typeparam name="T">The type of the type definition provider.</typeparam> |
| | | 34 | | /// <returns>The service collection.</returns> |
| | 705 | 35 | | public static IServiceCollection AddTypeDefinitionProvider<T>(this IServiceCollection services) where T: class, ITyp |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// Adds a <see cref="ITypeDefinitionProvider"/> to the service collection. |
| | | 39 | | /// </summary> |
| | | 40 | | /// <param name="services">The service collection.</param> |
| | | 41 | | /// <param name="factory">A callback to create the type definition provider.</param> |
| | | 42 | | /// <typeparam name="T">The type of the type definition provider.</typeparam> |
| | | 43 | | /// <returns>The service collection.</returns> |
| | | 44 | | public static IServiceCollection AddTypeDefinitionProvider<T>(this IServiceCollection services, Func<IServiceProvide |
| | 0 | 45 | | services.AddScoped<ITypeDefinitionProvider, T>(); |
| | | 46 | | |
| | | 47 | | /// <summary> |
| | | 48 | | /// Adds a <see cref="IVariableDefinitionProvider"/> to the service collection. |
| | | 49 | | /// </summary> |
| | 235 | 50 | | public static IServiceCollection AddVariableDefinitionProvider<T>(this IServiceCollection services) where T: class, |
| | | 51 | | |
| | | 52 | | /// <summary> |
| | | 53 | | /// Adds a <see cref="IVariableDefinitionProvider"/> to the service collection. |
| | | 54 | | /// </summary> |
| | | 55 | | public static IServiceCollection AddVariableDefinitionProvider<T>(this IServiceCollection services, Func<IServicePro |
| | 0 | 56 | | services.AddScoped<IVariableDefinitionProvider, T>(factory); |
| | | 57 | | } |