Automatically create metadata classes for Entity Framework

I am considering using xVal to validate Entity Framework classes in an MVC application. This includes writing metadata classes detailed by Graham O'Neill ( http://goneale.com/2009/03/04/using-metadatatype-attribute-with-aspnet-mvc-xval-validation-framework ).

I am wondering if there is a way to automatically create such metadata classes using metadata from an SQL database (for example: non-empty fields will have the class attribute [Required].

+4
source share
3 answers

You can use the Code Smith tool www.codesmithtools.com (there is a free version, if I remember correctly)

+3
source

I wrote an application that will read an existing database and then generate a data annotation class for each table (excluding aspnet_ * and VersionInfo).

http://pfsolutions-mi.com/Product/MetaDataClassGenerator

+1
source

Source: https://habr.com/ru/post/1300749/


All Articles