Skip to content

Commit 6369ff3

Browse files
update faq
1 parent 58a58dd commit 6369ff3

File tree

1 file changed

+12
-0
lines changed
  • articles/azure-app-configuration

1 file changed

+12
-0
lines changed

articles/azure-app-configuration/faq.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,18 @@ sections:
181181
182182
To select other labels and your Spring profile(s), you can use a label filter like `',${spring.profiles.active}'`, which will select all keys without a label and the ones matching your Spring profiles. The rightmost label(s) take priority when duplicate keys are found.
183183
184+
- question: How to use Feature Management in Blazor applications or as scoped services in .NET?
185+
answer: |
186+
The .NET Feature Management library provides the API `AddFeatureManagement` method which adds feature management services as singletons within the application, but there are scenarios where it may be necessary for feature management services to be added as scoped services instead. For example, users may want to use feature filters which consume scoped services for context information. This issue will occur while using the built-in targeting filter in Blazor server applications.
187+
188+
In regular ASP.NET web application, the singleton `IHttpContextAccessor` [pattern](https://learn.microsoft.com/en-us/azure/azure-app-configuration/howto-targetingfilter-aspnet-core#update-the-web-application-code-to-use-targetingfilter) is used to obtain the targeting context from `HttpContext`. However, this pattern does not work for Blazor server applications, because `HttpContext` is unavailable. [The recommended approach](https://learn.microsoft.com/en-us/aspnet/core/blazor/security/server/interactive-server-side-rendering?view=aspnetcore-7.0#ihttpcontextaccessorhttpcontext-in-razor-components) for passing http context in Blazor apps is to copy the data into a scoped service.
189+
190+
To consume scoped services for context information, the feature management services need to be registered as scoped services. In this case, the API `AddScopedFeatureManagement` should be used instead. This will ensure that feature management services, including feature filters, are added as scoped services.
191+
192+
```C#
193+
services.AddScopedFeatureManagement();
194+
```
195+
184196
- question: How can I receive announcements on new releases and other information related to App Configuration?
185197
answer: |
186198
Subscribe to our [GitHub announcements repo](https://github.com/Azure/AppConfiguration-Announcements).

0 commit comments

Comments
 (0)