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:
13
DigitalData.UserManager.API/Models/Constants.cs
Normal file
13
DigitalData.UserManager.API/Models/Constants.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user