Ado.net EDMX模型表中的字段自定义验证 [英] Ado.net EDMX model table fields custom validation

查看:419
本文介绍了Ado.net EDMX模型表中的字段自定义验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经生成使用选项在实体框架生成数据库模型中的数据表的模型现在模型包含IDE生成的模型code。

I have generated the data table model using the option "Generate model from database" in the entity framework and now the model contains the IDE generated code of the models.

该机型工作正常,现在我有一个问题,因为我想自定义的验证添加到表字段和错误信息和放大器;字段名称应该从资源文件作出。验证应在Ajax调用来完成。

The models are working fine and now I have a problem, because I want to add custom validations to the table fields and the error messages & the field names should be taken from the resource file. The validation should be done in the ajax call.

谁能帮我把这些验证添加到自动生成的模型code。以及如何映射资源文件的验证信息和字段名自动生成的模型。

Can anyone help me to add these validations to the automatically generated model code. And also how to map the resource file validation messages and field names to the auto generated Models.

先谢谢了。

推荐答案

电火花产生的实体可以使用数据注释和巴迪班进行验证。有一位优秀的教程从斯科特谷。数据标注信息可以很容易地外部化到资源文件

You can use the Data Annotations and Buddy classes for validation of EDM generated entities. There is an excellent tutorial from Scott Gu. Data annotations messages can easily be externalized to resource files.

这篇关于Ado.net EDMX模型表中的字段自定义验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆