web:asp.net:core:configuration
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
web:asp.net:core:configuration [2017/11/01 19:55] – [Exemple simple] sgariepy | web:asp.net:core:configuration [2023/11/17 20:09] (Version actuelle) – [Providers] sgariepy | ||
---|---|---|---|
Ligne 22: | Ligne 22: | ||
<code csharp> | <code csharp> | ||
{ | { | ||
- | // http:// | ||
" | " | ||
" | " | ||
Ligne 77: | Ligne 76: | ||
services.AddOptions(); | services.AddOptions(); | ||
+ | services.Configure< | ||
+ | </ | ||
+ | Dans une classe consommatrice, | ||
- | services.Configure<MyOptions>(this.Configuration.GetSection(" | + | |
+ | <code csharp> | ||
+ | public class MyClass | ||
+ | { | ||
+ | private readonly string[] _myOptions; | ||
+ | |||
+ | public MyClass(IOptions< | ||
+ | { | ||
+ | | ||
+ | } | ||
+ | } | ||
</ | </ | ||
+ | |||
+ | |||
+ | ====== Providers ====== | ||
+ | |||
+ | |||
+ | ^ Provider | ||
+ | | appsettings.json | ||
+ | | appsettings.{ENVIRONMENT}.json | ||
+ | | User Secrets (Developement) | '' | ||
+ | | Environment variables | ||
+ | | Command-line arguments | ||
+ | |||
+ | |||
+ | L' | ||
+ | Source: [[https:// | ||
web/asp.net/core/configuration.1509562533.txt.gz · Dernière modification : 2022/02/02 00:43 (modification externe)