Skip to content
DocsTry Aspire
DocsTry

NameValidationPolicyAnnotation Properties

ClassProperties5 members
Represents an annotation that customizes the name validation rules applied to a resource when it is added to the application model.
MaxLengthSection titled MaxLengthnullableint?
Gets the maximum allowed length for the resource name, or null to disable length validation. Defaults to ModelName.DefaultMaxLength.
public int? MaxLength { get; init; }
ValidateAllowedCharactersSection titled ValidateAllowedCharactersbool
Gets a value indicating whether to validate that the name contains only ASCII letters, digits, and hyphens. Defaults to true.
public bool ValidateAllowedCharacters { get; init; }
ValidateNoConsecutiveHyphensSection titled ValidateNoConsecutiveHyphensbool
Gets a value indicating whether to validate that the name does not contain consecutive hyphens. Defaults to true.
public bool ValidateNoConsecutiveHyphens { get; init; }
ValidateNoTrailingHyphenSection titled ValidateNoTrailingHyphenbool
Gets a value indicating whether to validate that the name does not end with a hyphen. Defaults to true.
public bool ValidateNoTrailingHyphen { get; init; }
ValidateStartsWithLetterSection titled ValidateStartsWithLetterbool
Gets a value indicating whether to validate that the name starts with an ASCII letter. Defaults to true.
public bool ValidateStartsWithLetter { get; init; }