microsoft / FeatureManagement-Dotnet

Microsoft.FeatureManagement provides standardized APIs for enabling feature flags within applications. Utilize this library to secure a consistent experience when developing applications that use patterns such as beta access, rollout, dark deployments, and more.
MIT License
1.02k stars 111 forks source link

Modified FeatureManager to accept optional parameters for FeatureFilters and SessionManagers. #434

Closed wenkepaul closed 2 months ago

wenkepaul commented 4 months ago

I'm working on a project which doesn't use IServiceCollection or C# 9, but would benefit from using this library. In order to do so, I need to be able to set the FeatureFilters property without using init. This PR addsEnumerable<IFeatureFilterMetadata> and IEnumerable<ISessionManager> as optional parameters to the FeatureManager constructor and uses their existing Enumerable.Empty as a fallback.

wenkepaul commented 4 months ago

@microsoft-github-policy-service agree

jimmyca15 commented 4 months ago

@wenkepaul can you open up an issue so the problem can be discussed?

wenkepaul commented 4 months ago

@jimmyca15 issue 435 has been opened.

zhiyuanliang-ms commented 3 months ago

/AzurePipeline run

azure-pipelines[bot] commented 3 months ago
Azure Pipelines successfully started running 1 pipeline(s).
zhiyuanliang-ms commented 3 months ago

I need to be able to set the FeatureFilters property without using init.

Do you mean the IsExternalInit pattern will not resolve the init accessor issue for .NET Framework? https://github.com/microsoft/FeatureManagement-Dotnet/blob/main/src/Microsoft.FeatureManagement/IsExternalInit.cs

alexaka1 commented 3 months ago

@zhiyuanliang-ms For me in a 4.7.2 project that doesn't use the SDK style project, the IsExternalInit does not solve the build error.

jimmyca15 commented 2 months ago

@zhiyuanliang-ms was this superseded by https://github.com/microsoft/FeatureManagement-Dotnet/pull/450 ?

zhiyuanliang-ms commented 2 months ago

@zhiyuanliang-ms was this superseded by #450 ?

@jimmyca15 I think, yes.

@wenkepaul I will close this PR. If you think the current solution still cannot meet your need, feel free to open an issue to track it.