Skip to content

Commit 9a1ae62

Browse files
update
1 parent 97471f5 commit 9a1ae62

File tree

1 file changed

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

1 file changed

+2
-2
lines changed

articles/azure-app-configuration/faq.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ sections:
185185
answer: |
186186
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.
187187
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.
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.
189189
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.
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.
191191
192192
```C#
193193
services.AddScopedFeatureManagement();

0 commit comments

Comments
 (0)