Friday, June 10, 2016

Generating Entity Framework Code First POCO classes

Normally, when you think of Entity Framework Code First, you think that you have to generate all of your POCO classes completely by hand!

Fortunately, though, a clever developer has created the Entity Framework Reverse POCO Generator! https://visualstudiogallery.msdn.microsoft.com/ee4fcff9-0c4c-4179-afd9-7a2fb90f5838

If you are using Visual Studio 2013, you will also need to install the Entity Framework 6 Tools for Visual Studio 2013 from here: https://www.microsoft.com/en-us/download/details.aspx?id=40762

This Visual Studio extension allows you to generate Entity Framework Code First POCO classes directly from your database!

Unfortunately, all of the POCO classes are generated into a single class file, but you can then use a tool such as Resharper to extract the classes into separate C# files and then customize the generated POCO classes to ensure they match the design requirements of your system!

How neat is that??

No comments:

Post a Comment