摘要:
1.什么是annotations 和 fluent api? 两者都是用来对mvc中的model进行限定的,比如规定某个字符串属性要【 非空,最长为50个字符】。annotations和fluent api 是两种风格的写法。(a) annotations风格是指 直接在model 这个类 把限制标注在属性的上面:[Required,MaxLength(50)]public string Name{get;set;}(b) fluent api 风格 是用单独的代码 写出 属性的 限定条件。modelBuilder.Entity().Property(p => p.Name).HasMa 阅读全文