You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/BlazorServerApp/README.md
+32-21Lines changed: 32 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,34 +17,44 @@ This app demonstrates how to use the Feature Management library in Blazor apps.
17
17
This app uses two feature flags: "BrowserEnhancement" and "Beta".
18
18
19
19
```json
20
-
"FeatureManagement": {
21
-
"BrowserEnhancement": {
22
-
"EnabledFor": [
23
-
{
24
-
"Name": "Browser",
25
-
"Parameters": {
26
-
"AllowedBrowsers": [ "Edge" ]
27
-
}
20
+
"feature_management": {
21
+
"feature_flags": [
22
+
{
23
+
"id": "BrowserEnhancement",
24
+
"enabled": true,
25
+
"conditions": {
26
+
"client_filters": [
27
+
{
28
+
"name": "Browser",
29
+
"parameters": {
30
+
"AllowedBrowsers": [ "Edge" ]
28
31
}
32
+
}
29
33
]
34
+
}
30
35
},
31
-
"Beta": {
32
-
"EnabledFor": [
33
-
{
34
-
"Name": "Targeting",
35
-
"Parameters": {
36
-
"Audience": {
37
-
"DefaultRolloutPercentage": 50,
38
-
"Exclusion": {
39
-
"Groups": [
40
-
"Guests"
41
-
]
42
-
}
43
-
}
36
+
{
37
+
"id": "Beta",
38
+
"enabled": true,
39
+
"conditions": {
40
+
"client_filters": [
41
+
{
42
+
"name": "Targeting",
43
+
"parameters": {
44
+
"Audience": {
45
+
"DefaultRolloutPercentage": 50,
46
+
"Exclusion": {
47
+
"Groups": [
48
+
"Guests"
49
+
]
44
50
}
51
+
}
45
52
}
53
+
}
46
54
]
55
+
}
47
56
}
57
+
]
48
58
}
49
59
```
50
60
@@ -65,6 +75,7 @@ This app uses [cookie authentication](https://learn.microsoft.com/en-us/aspnet/c
65
75
Rather than `HttpContext`, the [`AuthenticationStateProvider`](https://learn.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-8.0#authenticationstateprovider-service) service is used to obtain the user authentication state information for setting targeting context. The details can be found in the [`MyTargetingContextAccessor`](./MyTargetingContextAccessor.cs).
66
76
67
77
## Service Registration
78
+
68
79
Blazor applications like this one typically pull ambient contextual data from scoped services. For example, the `UserAgentContext`, `AuthenticationStateProvider` and `ITargetingContextAccessor` are all scoped services. This pattern *breaks* if the feature management services are added as singleton, which is typical in non-blazor web apps.
0 commit comments