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.05k stars 114 forks source link

question: Is it supported on net framework 4.8 and web.config? #511

Open aberbegall opened 6 days ago

aberbegall commented 6 days ago

Is it supported on net framework 4.8 project with web.config?

zhiyuanliang-ms commented 6 days ago

Hi, @aberbegall I think so. Since we are targeted on netstandard. Did you meet any specific problem while using this library in your .net framework project?

aberbegall commented 6 days ago

@zhiyuanliang-ms thanks for your reply. My main problem is how to set it up. I can add the nugget package but I am struggling to register the FeatureManager service with unity and how to specify the feature in the web.config as I do in appsettings.json...

I need to port this line from my test project (minimal API): builder.Services.AddFeatureManagement().AddFeatureFilter<MyFeatureFilter>();

and this settings:

"FeatureManagement": {
  "MyFeatureFilter": {
    "EnabledFor": [
      {
        "Name": "MyFeatureFilter"
      }
    ]
  }
}

to the ASP.NET ways of working :) best would be to find an example or any code tip, many thanks

zhiyuanliang-ms commented 6 days ago

@aberbegall

Feature management is built on the .net configuration system. Here is our doc. Anyway, you need a IConfiguration as the feature flag source.

The whole library is designed to be used with dependency injection. However, we also supports the non-DI usage.

Here we have a quickstart about how to use feature management in a non-DI way.

Can you also check #446

BTW, is that possible for you migrate configuration as this doc said?

aberbegall commented 6 days ago

@zhiyuanliang-ms thanks for the links and tips... I have a ASP.NET MVC project with Startup.cs with Owin and Unity IoC and the web.config required for the IIS app setup.

I hold plenty of web app settings in the web.config and I need to keep them there, cannot be migrated to appsettings.

I will examine the given links and see any possibilities to keep my web.config and sort out the Feature Flag declaration.