Exemplo n.º 1
0
        public static void AddFilter(this HubOptions options, Type filterType)
        {
            _ = options ?? throw new ArgumentNullException(nameof(options));
            _ = filterType ?? throw new ArgumentNullException(nameof(filterType));

            options.AddFilter(new HubFilterFactory(filterType));
        }
Exemplo n.º 2
0
        /// <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));
        }
Exemplo n.º 3
0
        public static void AddFilter <TFilter>(this HubOptions options) where TFilter : IHubFilter
        {
            _ = options ?? throw new ArgumentNullException(nameof(options));

            options.AddFilter(typeof(TFilter));
        }
Exemplo n.º 4
0
        /// <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));
        }