/// <summary> /// Adds all activities (including execute-only activities) in the specified assemblies matching the namespace. /// </summary> /// <param name="configurator"></param> /// <param name="type">The type to use to identify the assembly and namespace to scan</param> /// <param name="filter"></param> public static void AddActivitiesFromNamespaceContaining(this IRegistrationConfigurator configurator, Type type, Func <Type, bool> filter = null) { if (type == null) { throw new ArgumentNullException(nameof(type)); } if (type.Assembly == null || type.Namespace == null) { throw new ArgumentException($"The type {TypeMetadataCache.GetShortName(type)} is not in an assembly with a valid namespace", nameof(type)); } IEnumerable <Type> types; if (filter != null) { bool IsAllowed(Type candidate) { return(TypeMetadataCache.IsActivityOrDefinition(candidate) && filter(candidate)); } types = FindTypesInNamespace(type, IsAllowed); } else { types = FindTypesInNamespace(type, TypeMetadataCache.IsActivityOrDefinition); } AddActivities(configurator, types.ToArray()); }