MetadataType来帮助entity framework自动生成的代码进行标注

真的是,用的时候就四处google,还是记在这里容易找

[MetadataType(typeof(Person.Metadata))]
public partial class Person {
    private sealed class MetaData {
        [RegularExpression(...)]
        public string Email { get; set; }
    }
}

 

posted @ 2014-04-11 15:41  真幻de现实  阅读(310)  评论(0编辑  收藏  举报