How to use Data Annotations with Sharp Architecture
We recently upgraded to MVC2 and SharpArchitecture 1.6. Our models are all in our Project.Core project, while resources are in our Project.Web project. We can't reference the resource files in Core , as that would create 开发者_如何学Pythona circular dependency.
We want to use Data Annotations on the model - is there a way to access the resource files so we can have localized messages?
Why not extract in a stand alone project all your resources? you can then reference them from every project without the circular reference. From dataannotaion you link them like this
[Required(ErrorMessageResourceType = typeof(Resources.Validations), ErrorMessageResourceName = "Required")]
精彩评论