namespace Elsa.Workflows.Management.Options;
///
/// Represents the options for managing host method-based activities in workflows.
///
public class HostMethodActivitiesOptions
{
///
/// Maps a registration key to a CLR type whose public async methods should be exposed as activities.
///
public IDictionary ActivityTypes { get; } = new Dictionary(StringComparer.OrdinalIgnoreCase);
///
/// Adds a new activity type to the collection of activity types.
///
/// The type of the activity to add.
/// An optional key to associate with the activity type. If not provided, the type's name will be used.
public HostMethodActivitiesOptions AddType(string? key = null) where T : class
{
key ??= typeof(T).Name;
ActivityTypes[key] = typeof(T);
return this;
}
///
/// Adds a new activity type to the collection of activity types.
///
/// The type of the activity to add.
/// An optional key to associate with the activity type. If not provided, the type's name will be used.
public HostMethodActivitiesOptions AddType(Type type, string? key = null)
{
key ??= type.Name;
ActivityTypes[key] = type;
return this;
}
}