feat(Konstanten): Erzeugen von Optionen aus Appsettings über IOptions.

- Konstantenmodell mit UserLanguages String-Array erstellen. Hinzufügen einer benutzerdefinierten Methode zum Abrufen der Eigenschaft über Name.
- imlement in appsettings und confgire in Program.cs
This commit is contained in:
Developer 02
2024-09-26 13:03:49 +02:00
parent 84982e0286
commit 698151baf3
4 changed files with 52 additions and 2 deletions

View File

@@ -0,0 +1,13 @@
using System.Reflection;
namespace DigitalData.UserManager.API.Models
{
public class Constants
{
public IEnumerable<string> UserLanguages { get; init; } = Array.Empty<string>();
public object? this[string propertyName] => GetType()
.GetProperty(propertyName, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance)?
.GetValue(this, null);
}
}