开发者

ASP.NET MVC DataAnnotations different table. Can it be done?

开发者 https://www.devze.com 2023-01-03 19:26 出处:网络
i have a language table which is as a foreign key in the link table , The link can be in 3 languages meaning there will be 3 rows in the link table every time i enter the record . i am using jQuery ta

i have a language table which is as a foreign key in the link table , The link can be in 3 languages meaning there will be 3 rows in the link table every time i enter the record . i am using jQuery tabs to enter the records in 3 languages . OK so that thing is that there will be three text boxes for every field in the table.link name field will have 3 text boxes, description will have 3 text boxes and so on. i am using LINK to SQL with VS2010.

i will be creating link class with MetadataType so how will i开发者_开发百科 handle for eg link name attribute 3 times


Localization isn't inherently supported in DataAnnotations or "buddy classes" as far as I know. I could recommend changes to your schema to allow multiple languages and will stored them relationally - but this would be a pretty standard approach to localization that has already been solved time and time again. The most outlandish approach would be to modify the DataAnnotationsModelBinder since it is an open source project posted on CodePlex. The System.ComponentModel.DataAnnotations namespace seems a little more concrete to me, so I have been trying to work within its current capabilities.


Phil Haack has an article about globalizing ASP.NET validation. I wonder if a similar implementation might work.

You could then try and localize your strings to the database if you wanted by creating an implementation of the ResourceProvider model that uses the database. In the past we have used the method outlined here.

0

精彩评论

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