Skip to content

ValidateEmailAttribute class

namespace: Serenity.ComponentModel   assembly: Serenity.Net.Core

Requires a text to be an email address, by Pattern, which is stricter than EmailAddressAttribute, as that only checks for an @ that is not the first or the last character, and can not be derived from. Like it, it is a DataTypeAttribute of EmailAddress, which tools like OpenAPI read. The forms also check it. An empty value is valid, as being required is RequiredAttribute's concern.

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
public class ValidateEmailAttribute : DataTypeAttribute, IClientValidationRule, IHasTextKey

Public Members

name description
ValidateEmailAttribute() Requires a text to be an email address, by Pattern, which is stricter than EmailAddressAttribute, as that only checks for an @ that is not the first or the last character, and can not be derived from. Like it, it is a DataTypeAttribute of EmailAddress, which tools like OpenAPI read. The forms also check it. An empty value is valid, as being required is RequiredAttribute's concern.
Rule { get; }
RuleParams { get; }
Side { get; set; }
TextKey { get; set; }
override IsValid(…)
const Key The type key of the class of the rule on the client side, i.e. Serenity.EmailValidationRule.
static readonly Pattern The pattern of an email address, of ASCII letters, digits and the symbols an address can have before the @, and a domain of labels of letters, digits and hyphens.

Protected Members

name description
override IsValid(…)

See Also