elleryq
10/13/2011 - 5:05 AM

gistfile1.cs

using System.ComponentModel.DataAnnotations;

[MetadataType(typeof(MemberMetadata))]
public partial class Member
{
  private class MemberMetadata
  {
    public int ID { get; set; }

    [Required(ErrorMessage="Please input account")]
    [StringLength(50,ErrorMessage="Don't over 50 characters")]
    [DisplayName("Account")]
    public string Account { get; set; }
  }
}
// You can also use RegularExpression, Range... these attributes to annotation properties.