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.
| 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.
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
* Merge pull request #556 from microsoft/zhiyuanliang/fix-snapshot-bug Fix snapshot cache key bug * add testcase for configuration manager (#557) * Expose time provider for TimeWindowFilter (#562) * Update FilterCollectionExtensions (#359) * update * update * update * update AddForFeature * add test * update * version bump 4.4.0 (#569)
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: