| | | 1 | | using Elsa.Workflows.Management.Options; |
| | | 2 | | using Elsa.Workflows.Models; |
| | | 3 | | using JetBrains.Annotations; |
| | | 4 | | using Microsoft.Extensions.Options; |
| | | 5 | | |
| | | 6 | | namespace Elsa.Workflows.Management.Activities.HostMethod; |
| | | 7 | | |
| | | 8 | | /// <summary> |
| | | 9 | | /// Provides activities for each configured host method type registered via <see cref="HostMethodActivitiesOptions"/>. |
| | | 10 | | /// Public instance methods of the configured types are exposed as activities (as determined by <see cref="IHostMethodAc |
| | | 11 | | /// Inputs come from public properties and method parameters. |
| | | 12 | | /// </summary> |
| | | 13 | | [UsedImplicitly] |
| | 441 | 14 | | public class HostMethodActivityProvider(IOptions<HostMethodActivitiesOptions> options, IHostMethodActivityDescriber host |
| | | 15 | | { |
| | | 16 | | public async ValueTask<IEnumerable<ActivityDescriptor>> GetDescriptorsAsync(CancellationToken cancellationToken = de |
| | | 17 | | { |
| | 14 | 18 | | var descriptors = new List<ActivityDescriptor>(); |
| | | 19 | | |
| | 84 | 20 | | foreach (var kvp in options.Value.ActivityTypes) |
| | | 21 | | { |
| | 28 | 22 | | var key = kvp.Key; |
| | 28 | 23 | | var type = kvp.Value; |
| | 28 | 24 | | var methodDescriptors = await hostMethodActivityDescriber.DescribeAsync(key, type, cancellationToken); |
| | 28 | 25 | | descriptors.AddRange(methodDescriptors); |
| | | 26 | | } |
| | | 27 | | |
| | 14 | 28 | | return descriptors; |
| | 14 | 29 | | } |
| | | 30 | | } |