Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Add generic overload/extension method for MvcOptions.Filters.AddService<FilterType> #6395

Closed
DamianEdwards opened this issue Jun 13, 2017 · 5 comments

Comments

@DamianEdwards
Copy link
Member

We should add an extension method to MvcOptions.Fiters that allows adding a service-based filter type via a generic argument, e.g.:

services.AddMvc(options =>
        {
            options.Filters.AddService<RequireLoginFilter>();
        });

@rynowak @davidfowl

@Eilon
Copy link
Member

Eilon commented Jun 13, 2017

Basically a convenience version of this: https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.Core/Filters/FilterCollection.cs#L73

Should add:

  1. Add<TFilterType>()
  2. Add<TFilterType>(int order)
  3. AddService<TFilterType>()
  4. AddService<TFilterType>(int order)

@rynowak
Copy link
Member

rynowak commented Jun 13, 2017

@rynowak
Copy link
Member

rynowak commented Jun 27, 2017

@jbagga - looks like we got a PR for this that will satisfy the requirements, so no need for you to take action here

@rynowak
Copy link
Member

rynowak commented Jun 28, 2017

7166dfe

@rynowak
Copy link
Member

rynowak commented Jun 28, 2017

Thanks @henkmollema

@jbagga jbagga removed their assignment Jun 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants