Data Annotation
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace MyAwesomeMVCApp.Models{
public class Customer
{
[Required]
[RegularExpression("^[A-Z]{3,3}[0-9]{4,4}$")]
public string CustomerCode { get; set; }
[Required]
[StringLength(25)]
public string CustomerName { get; set; }
}
}When do these validations happen
Last updated