Modèle d'options comment utiliser
// AppSettingsController.cs
[Route("appsettings")]
public class AppSettingsController : Controller
{
...
protected readonly IOptions<RoundTheCodeSync> _roundTheCodeSyncOptions;
public AppSettingsController(..., IOptions<RoundTheCodeSync> roundTheCodeSyncOptions)
{
...
_roundTheCodeSyncOptions = roundTheCodeSyncOptions;
}
...
[Route("second-way")]
public IActionResult SecondWay()
{
return Content(_roundTheCodeSyncOptions.Value.Title, "text/plain");
}
}
Nervous Nightingale