Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Entity Framework Power Tools in Visual Studio 2015?

I have used Entity Framework in Visual Studio 2012. Build entity model by "reverse engineer code first".

But when I setup Visual Studio 2015 just now, and setup EF power tools by NuGet, I can not find "reverse engineer code first" option.

Anyone knows what i should do?

Thanks!

like image 275
Mike Avatar asked Jan 17 '15 11:01

Mike


People also ask

What is Entity Framework Tools for Visual Studio?

Entity Framework is an object-relational mapping technology that enables . NET developers to work with relational data by using domain-specific objects. It eliminates the need for most of the data-access code that developers usually need to write.


2 Answers

Entity Framework Power Tools is a Visual Studio extension, so you need to install it first. But, there is a problem, the supported versions of Visual Studio are 2010, 2012 and 2013. Visual Studio 2015 is in Preview Version. I think that's why it is not included yet. But I have a solution that works for me in case like this.

  1. Download Entity Framework Power Tools
  2. The .vsix file is a zip, so you can unzip it using Winrar (or any other program with this functions). Unzip only the file named extension.vsixmanifest
  3. In this file (it's a xml) you need to find a tag named SupportedProducts and add the Visual Studio 2015 version (go to Help->About Microsoft Visual Studio to check what edition you have installed) .

     <SupportedProducts>    ...    <VisualStudio Version="14.0">      <Edition>Ultimate</Edition>      <Edition>Community</Edition>    </VisualStudio>  </SupportedProducts> 
  4. Overwrite the extension.vsixmanifest file in the .vsix, and try to install that.

Hope this help

Update 1

I tried with that configuration (Version:14.0 and Edition:Ultimate) and It worked.To save time, you can download it in this link. I also added the Community edition.

Update 2

Julie Lerman wrote an article in her blog about how to solve this issue as well.

Update 3

I strongly recommend to use EntityFramework Reverse POCO Generator when you are working with legacy databases. If your schema could change several times not using migrations, then is preferable to have t4 template which can help you to re-generate the model every time the DB is updated. The only you need to do is right click on your .tt file and execute Run Custom Tool option, that's all. EF Power Tools also has an option that allows you to customize the t4 template.

like image 189
octavioccl Avatar answered Oct 12 '22 01:10

octavioccl


Now that VS 2015 is released, you will want to use EntityFramework Reverse POCO Generator https://visualstudiogallery.msdn.microsoft.com/ee4fcff9-0c4c-4179-afd9-7a2fb90f5838. ALthough the instructions are a little involved, the tweaks/workarounds mentioned above are no longer needed, and it works great.

like image 40
ckapilla Avatar answered Oct 12 '22 01:10

ckapilla