Skip to content

Instantly share code, notes, and snippets.

Created June 15, 2023 16:11
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
public static class ConfigurationBinderExtensions
public static ValidateOptionsResult BindAndValidate<TOptions>(this IConfiguration configuration, TOptions instance) where TOptions : class, new()
var validateOptions = new DataAnnotationValidateOptions<TOptions>(Options.DefaultName);
return validateOptions.Validate(Options.DefaultName, instance);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment