Skip to content

Commit d4f74e5

Browse files
resolve comments
1 parent 9a1ae62 commit d4f74e5

File tree

1 file changed

+5
-5
lines changed
  • articles/azure-app-configuration

1 file changed

+5
-5
lines changed

articles/azure-app-configuration/faq.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,16 @@ sections:
183183
184184
- question: How to use Feature Management in Blazor applications or as scoped services in .NET?
185185
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 the information of HttpContext in Blazor apps is to copy the data into a scoped service. Then, the targeting context accessor should consume that scoped service to determine the targeting context.
189-
190-
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.
186+
The API `AddScopedFeatureManagement` should be used. This will ensure that feature management services, including feature filters, are added as scoped services.
191187
192188
```C#
193189
services.AddScopedFeatureManagement();
194190
```
195191
192+
The `Microsoft.FeatureManagement` 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.
193+
194+
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 the information of HttpContext in Blazor apps is to copy the data into a scoped service. Then, the targeting context accessor should consume that scoped service to determine the targeting context. In this case, the API `AddScopedFeatureManagement` should be used instead.
195+
196196
- question: How can I receive announcements on new releases and other information related to App Configuration?
197197
answer: |
198198
Subscribe to our [GitHub announcements repo](https://github.com/Azure/AppConfiguration-Announcements).

0 commit comments

Comments
 (0)