/// <summary> /// Adds an <see cref="IHubFilter"/> type to the <see cref="HubOptions"/> that will be resolved via DI or type activated. /// </summary> /// <param name="options">The options to add a filter to.</param> /// <param name="filterType">The <see cref="IHubFilter"/> type that will be added to the options.</param> public static void AddFilter(this HubOptions options, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type filterType) { _ = options ?? throw new ArgumentNullException(nameof(options)); _ = filterType ?? throw new ArgumentNullException(nameof(filterType)); options.AddFilter(new HubFilterFactory(filterType)); }
/// <summary> /// Adds an <see cref="IHubFilter"/> type to the <see cref="HubOptions"/> that will be resolved via DI or type activated. /// </summary> /// <typeparam name="TFilter">The <see cref="IHubFilter"/> type that will be added to the options.</typeparam> /// <param name="options">The options to add a filter to.</param> public static void AddFilter <[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TFilter>(this HubOptions options) where TFilter : IHubFilter { _ = options ?? throw new ArgumentNullException(nameof(options)); options.AddFilter(typeof(TFilter)); }