Skip to content

Update FilterCollectionExtensions #359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

zhiyuanliang-ms
Copy link
Contributor

The usage of AddForFeature is like:

services.AddMvc(o => 
{
    o.Filters.AddForFeature<ThirdPartyActionFilter>("MyFeatureFlag");
});

So it makes more sense to return FilterCollection to support the following usage:

services.AddMvc(o => 
{
    o.Filters.AddForFeature<ThirdPartyActionFilter1>("MyFeatureFlag1")
                .AddForFeature<ThirdPartyActionFilter2>("MyFeatureFlag2");
});

@rossgrambo
Copy link
Member

This is a "breaking" change so I'm not sure if we can do it. The reason "breaking" is in quotes is because it looks like we only ever return null here... But in the rare case where someone has:

services.AddMvc(o => 
{
    IFilterMetadata metadata = o.Filters.AddForFeature<ThirdPartyActionFilter>("MyFeatureFlag");
});

We would break them.

@zhiyuanliang-ms
Copy link
Contributor Author

@jimmyca15 How about make this PR targeting on preview branch to avoid making breaking changes on our current stable release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants