-
Notifications
You must be signed in to change notification settings - Fork 121
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
Update FilterCollectionExtensions #359
Conversation
|
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 services.AddMvc(o =>
{
IFilterMetadata metadata = o.Filters.AddForFeature<ThirdPartyActionFilter>("MyFeatureFlag");
});We would break them. |
|
@jimmyca15 How about make this PR targeting on preview branch to avoid making breaking changes on our current stable release? |
|
| IFilterMetadata filterMetadata = null; | ||
|
|
||
| filters.Add(new FeatureGatedAsyncActionFilter<TFilterType>(feature)); | ||
| filters.Add(new FeatureGatedAsyncActionFilter<TFilterType>(RequirementType.Any, false, feature)); | ||
|
|
||
| return filterMetadata; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| IFilterMetadata filterMetadata = null; | |
| filters.Add(new FeatureGatedAsyncActionFilter<TFilterType>(feature)); | |
| filters.Add(new FeatureGatedAsyncActionFilter<TFilterType>(RequirementType.Any, false, feature)); | |
| return filterMetadata; | |
| return filters.Add(new FeatureGatedAsyncActionFilter<TFilterType>(RequirementType.Any, false, feature)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above return type is not IFilterMetadata.
Only FilterCollection.Add<T> returns IFilterMetadata. https://github.com/dotnet/aspnetcore/blob/06a440549690d5dba8e3501c21c61907da69a733/src/Mvc/Mvc.Core/src/Filters/FilterCollection.cs#L12
src/Microsoft.FeatureManagement.AspNetCore/FilterCollectionExtensions.cs
Outdated
Show resolved
Hide resolved
|
Discussed offline, AddForFeature should return IFilterMetadata just like FilterCollection.Add does. |
…-Dotnet into zhiyuanliang/update-filter-collection-extensions
…tps://github.com/microsoft/FeatureManagement-Dotnet into zhiyuanliang/update-filter-collection-extensions
Why this PR?
Update
FilterCollectionExtensions#560Visible change
I really want to change the return type of this API to
FilterCollection:Because, filterMetadata will always be returned as
null. But as @rossgrambo mentioned, this is a breaking change.New APIs are added:
Usage: