Hey, I used your Package extensively and it was a pleasure!
Recently we migrated to Dotnet 8 which brings a native way of validating the configuration:
builder.Services.AddOptions<AppSettingsRootConfiguration>()
.BindConfiguration("")
.ValidateDataAnnotations()
.ValidateOnStart();
With Data Annotation on the RootConfiguration:
public class AppSettingsRootConfiguration
{
/// <summary>
/// The Main Configuration.
/// </summary>
/// <value>The configuration.</value>
[Required]
[ValidateObjectMembers]
public AppConfig ExampleToolConfiguration { get; set; }
[Required]
[ValidateEnumeratedItems]
public List<ComplexObject> ExampleList { get; set; }
}
I just wanted to share and thought adding this to the README might be a good place to promote the native way.
Be aware we came across a bug for Dictionaries: dotnet/runtime#97873
Hey, I used your Package extensively and it was a pleasure!
Recently we migrated to Dotnet 8 which brings a native way of validating the configuration:
With Data Annotation on the RootConfiguration:
I just wanted to share and thought adding this to the README might be a good place to promote the native way.
Be aware we came across a bug for Dictionaries: dotnet/runtime#97873