Skip to content

Commit 97471f5

Browse files
update
1 parent 6369ff3 commit 97471f5

File tree

1 file changed

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

1 file changed

+1
-1
lines changed

articles/azure-app-configuration/faq.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ 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 http context 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.
189189
190190
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.
191191

0 commit comments

Comments
 (0)