-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
DoneThis issue has been fixedThis issue has been fixedenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing one
Milestone
Description
From Experience review with @ajcvickers @DamianEdwards @Eilon @davidfowl :
We should support DataAnnotations on the POCO for 2.2:
for example:
public class MyOptions
{
[Required]
public string Key { get; set; }
[Range(18,99, ErrorMessage="Age should be between 18 and 99")]
public int Age { get; set; }
[DataType(DataType.PhoneNumber)]
[Phone]
Public string PhoneNumber { get; set; }
[DataType(DataType.EmailAddress)]
[EmailAddress]
Public string Email { get; set; }
}
Need to figure out how to opt in, via new default overload?
services.AddOptions<MyOptions>.[Auto]Validate()
Metadata
Metadata
Assignees
Labels
DoneThis issue has been fixedThis issue has been fixedenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing one