开发者

How to use Data Annotations with Sharp Architecture

开发者 https://www.devze.com 2023-03-30 21:19 出处:网络
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 ,

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")]
0

精彩评论

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