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.
精彩评论