简体   繁体   中英

Data Annotations for validate an entity framework entity

I used EF to create an entity.

Now The user can input datas to the DB trough entity framework.

I want to validate the object by using Data Annotations.

The solution should be to create one object that inherits of all the EF methods and validate the field.

So Do I have to redeclare all fields in the child class? or DO I have to redeclare the only class I want to validate?

Thanks for helping me, I'm new in c# .net workd

Duplicate post to

Philosophy : make a partial class and set the data annotations to another class

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM