Skip to content

Instantly share code, notes, and snippets.

@elleryq
Created October 13, 2011 05:05
Show Gist options
  • Save elleryq/1283434 to your computer and use it in GitHub Desktop.
Save elleryq/1283434 to your computer and use it in GitHub Desktop.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment