| | | 1 | | using Elsa.Workflows; |
| | | 2 | | using Elsa.Workflows.Helpers; |
| | | 3 | | using Elsa.Workflows.Models; |
| | | 4 | | |
| | | 5 | | // ReSharper disable once CheckNamespace |
| | | 6 | | namespace Elsa.Extensions; |
| | | 7 | | |
| | | 8 | | /// <summary> |
| | | 9 | | /// Adds extension methods to <see cref="IActivityRegistry"/>. |
| | | 10 | | /// </summary> |
| | | 11 | | public static class ActivityRegistryExtensions |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Finds the activity descriptor for the specified activity. |
| | | 15 | | /// </summary> |
| | 3544 | 16 | | public static Task<ActivityDescriptor?> FindAsync(this IActivityRegistryLookupService activityRegistry, IActivity ac |
| | | 17 | | |
| | | 18 | | /// <param name="activityRegistry">The activity registry.</param> |
| | | 19 | | extension(IActivityRegistry activityRegistry) |
| | | 20 | | { |
| | | 21 | | /// <summary> |
| | | 22 | | /// Finds the activity descriptor for the specified activity type. |
| | | 23 | | /// </summary> |
| | 7 | 24 | | public ActivityDescriptor? Find<T>() where T:IActivity => activityRegistry.Find(ActivityTypeNameHelper.GenerateT |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Registers the specified activity type with the registry. |
| | | 28 | | /// </summary> |
| | | 29 | | /// <param name="cancellationToken">The cancellation token.</param> |
| | | 30 | | /// <typeparam name="T">The type of the activity to register.</typeparam> |
| | | 31 | | public async Task RegisterAsync<T>(CancellationToken cancellationToken = default) where T : IActivity => |
| | 0 | 32 | | await activityRegistry.RegisterAsync(typeof(T), cancellationToken); |
| | | 33 | | } |
| | | 34 | | } |