-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Description
Description
I knew it was possible to rename properties while using the Options pattern, but I forgot the syntax.
While looking for information on this, the first hit on google was the learn website, but it doesn't mention how to do this. I also didn't find any other page that documents this (I did a search all on the website, and in this repository), except for the API docs.
That's why I propose to add a new section to the docs page, which includes an example.
For example:
public class MyConfig
{
public const string Position = "MyConfig";
[ConfigurationKeyName("BASE-URL")]
public required string BaseUrl { get; set; }
}In the above example, the ConfigurationKeyName maps the base-url config value to the BaseUrl property in C#.
If accepted, I can open a PR with the changes.
Page URL
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-9.0
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/configuration/options.md
Document ID
dc7e3449-650b-d117-5eac-69e5ccb250cb
Article author
Metadata
- ID: ed39cb0e-aa85-8bba-ffb4-859b56a60723
- PlatformId: c815d451-e2c8-0cf1-5862-03b12dd0392a
- Service: aspnet-core
- Sub-service: fundamentals