Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I programmatically generate Entity Framework classes from a database?

How can I programmatically generate Entity Framework classes from a database and then automatically compile them?

I'm looking for a solution that takes a simple connection string and generates a C# library. Exactly what Visual Studio's entity designer does but programmatically.

like image 343
Alon Gubkin Avatar asked Aug 05 '13 10:08

Alon Gubkin


1 Answers

You are looking for Entity Framework power tools.

With that you can create a code first database from a connectionstring (Reverse Engineer Code First ).

With Reverse Engineer Code First you get the code first classes + mapping classes. You can even modify the templates used for the process. All the information you need can be found in the above link.

like image 56
SynerCoder Avatar answered Nov 01 '22 06:11

SynerCoder