/// <summary>
        /// Adds the provided orchestration type to the builder.
        /// </summary>
        /// <param name="builder">The builder to add to, not null.</param>
        /// <param name="type">The orchestration type to add, not null.</param>
        /// <param name="includeAliases">Include <see cref="TaskAliasAttribute"/>.</param>
        /// <returns>The original builder with orchestration added.</returns>
        public static ITaskHubWorkerBuilder AddOrchestration(
            this ITaskHubWorkerBuilder builder, Type type, bool includeAliases)
        {
            Check.NotNull(builder, nameof(builder));
            builder.AddOrchestration(new TaskOrchestrationDescriptor(type));

            if (includeAliases)
            {
                foreach ((string name, string version) in type.GetTaskAliases())
                {
                    builder.AddOrchestration(new TaskOrchestrationDescriptor(type, name, version));
                }
            }

            return(builder);
        }
Пример #2
0
        /// <summary>
        /// Adds the provided orchestration type to the builder.
        /// </summary>
        /// <param name="builder">The builder to add to, not null.</param>
        /// <param name="type">The orchestration type to add, not null.</param>
        /// <param name="name">The name of the orchestration. Not null or empty.</param>
        /// <param name="version">The version of the orchestration.static Not null.</param>
        /// <returns>The original builder with orchestration added.</returns>
        public static ITaskHubWorkerBuilder AddOrchestration(
            this ITaskHubWorkerBuilder builder, Type type, string name, string version)
        {
            Check.NotNull(builder, nameof(builder));
            Check.NotNullOrEmpty(name, nameof(name));
            Check.NotNull(version, nameof(version));

            builder.AddOrchestration(new TaskOrchestrationDescriptor(type, name, version));
            return(builder);
        }
        /// <summary>
        /// Adds all <see cref="TaskOrchestration"/> in the provided assembly.
        /// Includes <see cref="TaskAliasAttribute"/>.
        /// </summary>
        /// <param name="builder">The builder to add to, not null.</param>
        /// <param name="assembly">The assembly to discover types from. Not null.</param>
        /// <param name="includePrivate">True to include private/protected/internal types, false for public only.</param>
        /// <returns>The original builder with activity added.</returns>
        public static ITaskHubWorkerBuilder AddOrchestrationsFromAssembly(
            this ITaskHubWorkerBuilder builder, Assembly assembly, bool includePrivate = false)
        {
            Check.NotNull(builder, nameof(builder));
            Check.NotNull(assembly, nameof(assembly));

            foreach (Type type in assembly.GetConcreteTypes <TaskOrchestration>(includePrivate))
            {
                builder.AddOrchestration(type);
            }

            return(builder);
        }
Пример #4
0
 /// <summary>
 /// Adds the provided orchestration type to the builder.
 /// </summary>
 /// <param name="builder">The builder to add to, not null.</param>
 /// <param name="type">The orchestration type to add, not null.</param>
 /// <returns>The original builder with orchestration added.</returns>
 public static ITaskHubWorkerBuilder AddOrchestration(this ITaskHubWorkerBuilder builder, Type type)
 {
     Check.NotNull(builder, nameof(builder));
     builder.AddOrchestration(new TaskOrchestrationDescriptor(type));
     return(builder);
 }
 /// <summary>
 /// Adds the provided orchestration type to the builder.
 /// </summary>
 /// <param name="builder">The builder to add to, not null.</param>
 /// <param name="includeAliases">Include <see cref="TaskAliasAttribute"/>.</param>
 /// <typeparam name="TOrchestration">The orchestration type to add.</typeparam>
 /// <returns>The original builder with orchestration added.</returns>
 public static ITaskHubWorkerBuilder AddOrchestration <TOrchestration>(
     this ITaskHubWorkerBuilder builder, bool includeAliases)
     where TOrchestration : TaskOrchestration
 => builder.AddOrchestration(typeof(TOrchestration), includeAliases);
 /// <summary>
 /// Adds the provided orchestration type to the builder.
 /// Includes <see cref="TaskAliasAttribute"/>.
 /// </summary>
 /// <param name="builder">The builder to add to, not null.</param>
 /// <typeparam name="TOrchestration">The orchestration type to add.</typeparam>
 /// <returns>The original builder with orchestration added.</returns>
 public static ITaskHubWorkerBuilder AddOrchestration <TOrchestration>(this ITaskHubWorkerBuilder builder)
     where TOrchestration : TaskOrchestration
 => builder.AddOrchestration(typeof(TOrchestration));
 /// <summary>
 /// Adds the provided orchestration type to the builder.
 /// Includes <see cref="TaskAliasAttribute"/>.
 /// </summary>
 /// <param name="builder">The builder to add to, not null.</param>
 /// <param name="type">The orchestration type to add, not null.</param>
 /// <returns>The original builder with orchestration added.</returns>
 public static ITaskHubWorkerBuilder AddOrchestration(this ITaskHubWorkerBuilder builder, Type type)
 => builder.AddOrchestration(type, includeAliases: true);
 /// <summary>
 /// Adds the provided orchestration type to the builder.
 /// </summary>
 /// <param name="builder">The builder to add to, not null.</param>
 /// <param name="name">The name of the orchestration. Not null or empty.</param>
 /// <param name="version">The version of the orchestration.static Not null.</param>
 /// <typeparam name="TOrchestration">The orchestration type to add.</typeparam>
 /// <returns>The original builder with orchestration added.</returns>
 public static ITaskHubWorkerBuilder AddOrchestration <TOrchestration>(
     this ITaskHubWorkerBuilder builder, string name, string version)
     where TOrchestration : TaskOrchestration
 => builder.AddOrchestration(typeof(TOrchestration), name, version);