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: articles/azure-functions/functions-dotnet-dependency-injection.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -148,7 +148,7 @@ Values defined in [app settings](./functions-how-to-use-azure-function-app-setti
148
148
149
149
You can extract values from the `IConfiguration` instance into a custom type. Copying the app settings values to a custom type makes it easy test your services by making these values injectable. Settings read into the configuration instance must be simple key/value pairs.
150
150
151
-
Consider the following class that includes a property named consistent with an app setting.
151
+
Consider the following class that includes a property named consistent with an app setting:
152
152
153
153
```csharp
154
154
publicclassMyOptions
@@ -157,13 +157,23 @@ public class MyOptions
157
157
}
158
158
```
159
159
160
+
And a `local.settings.json` file that might structure the custom setting as follows:
161
+
```json
162
+
{
163
+
"IsEncrypted": false,
164
+
"Values": {
165
+
"MyOptions:MyCustomSetting": "Foobar"
166
+
}
167
+
}
168
+
```
169
+
160
170
From inside the `Startup.Configure` method, you can extract values from the `IConfiguration` instance into your custom type using the following code:
0 commit comments