开发者

Entity Framework 4.1 Want the Model to have non-null validatiom but dont want the database to be not null

This might sound l开发者_JS百科ike a weird request but how do I enforce validation at the model level using DataAnnotations that aren't enforced at the data store level when using EF 4.1 Code First.


You cannot do that if you want to generate database from your mapping. Data annotation on mapped class defines mapping to database. If you need somewhere in UI to enforce different rules you need separate class for that - for example View model in ASP.NET MVC.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜