| | | 1 | | using System.Linq.Expressions; |
| | | 2 | | using Elsa.Extensions; |
| | | 3 | | using Elsa.Workflows.Models; |
| | | 4 | | using JetBrains.Annotations; |
| | | 5 | | |
| | | 6 | | namespace Elsa.Workflows.Management; |
| | | 7 | | |
| | | 8 | | /// <summary> |
| | | 9 | | /// Provides extension methods for <see cref="IActivityDescriber"/>. |
| | | 10 | | /// </summary> |
| | | 11 | | [PublicAPI] |
| | | 12 | | public static class ActivityDescriberExtensions |
| | | 13 | | { |
| | | 14 | | /// <param name="activityDescriber">The activity describer.</param> |
| | | 15 | | extension(IActivityDescriber activityDescriber) |
| | | 16 | | { |
| | | 17 | | /// <summary> |
| | | 18 | | /// Describes an output property. |
| | | 19 | | /// </summary> |
| | | 20 | | /// <param name="expression">The property expression.</param> |
| | | 21 | | /// <param name="cancellationToken">The cancellation token.</param> |
| | | 22 | | /// <typeparam name="TActivity">The type of the activity.</typeparam> |
| | | 23 | | /// <typeparam name="TProperty">The type of the property.</typeparam> |
| | | 24 | | /// <returns>The output descriptor.</returns> |
| | | 25 | | public async Task<OutputDescriptor> DescribeOutputProperty<TActivity, TProperty>(Expression<Func<TActivity, TPro |
| | | 26 | | { |
| | 0 | 27 | | var propertyInfo = expression.GetProperty()!; |
| | 0 | 28 | | return await activityDescriber.DescribeOutputPropertyAsync(propertyInfo, cancellationToken); |
| | 0 | 29 | | } |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// Describes an input property. |
| | | 33 | | /// </summary> |
| | | 34 | | /// <param name="expression">The property expression.</param> |
| | | 35 | | /// <param name="cancellationToken">The cancellation token.</param> |
| | | 36 | | /// <typeparam name="TActivity">The type of the activity.</typeparam> |
| | | 37 | | /// <typeparam name="TProperty">The type of the property.</typeparam> |
| | | 38 | | /// <returns>The input descriptor.</returns> |
| | | 39 | | public async Task<InputDescriptor> DescribeInputPropertyAsync<TActivity, TProperty>(Expression<Func<TActivity, T |
| | | 40 | | { |
| | 0 | 41 | | var propertyInfo = expression.GetProperty()!; |
| | 0 | 42 | | return await activityDescriber.DescribeInputPropertyAsync(propertyInfo, cancellationToken); |
| | 0 | 43 | | } |
| | | 44 | | } |
| | | 45 | | } |