Class AppConfigsLoader
Provides a product's settings from the settings files its project embeds from the private .user folder.
public static class AppConfigsLoader
- Inheritance
-
AppConfigsLoader
- Inherited Members
Methods
Load<T>()
Creates a product's settings and fills them from the embedded AppSettings.json, then
AppSettings_Environment.json, the build configuration's: each overrides by name and skips a key the type
does not have.
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(AppLinks))]
public static T Load<T>() where T : AppConfigs, new()
Returns
- T
The settings.
Type Parameters
TThe product's settings type, in the assembly that embeds the files.
Remarks
Both files are optional: a fork without them builds, and its settings keep their defaults. The type's public properties, and those of AppLinks, are kept for the trimmer, as only reflection sets them.
Exceptions
- JsonException
A file is not JSON, or a value does not fit its property.
- InvalidOperationException
A JSON value is not of the kind its property needs.
- UriFormatException
A Uri property's text is not a URI.
ReadResourceText(Assembly, string)
Reads a text file a project embedded, such as a secret.
public static string? ReadResourceText(Assembly assembly, string resourceName)