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

蹲街弑〆低调 提交于 2019-11-26 18:01:17

问题


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!


回答1:


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.




回答2:


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.




回答3:


I've updated the EF Power Tools to work for Visual Studio 2017 and I've made it availble to be downloded from my DropBox if anyone is interested:

EFPowerTools.vsix




回答4:


Just use the edm wizard, and use "code first from database", or if you do not like the attribute based code, use ef reverse poco template




回答5:


It even works with the community edition by setting Community.




回答6:


The problem you might see soon is that even EF power tools get installed in VS 2015 community edition, you probably use EF7, which has different way how to set a primary keys/configurations in general in entities. You might get POCO objects but with wrong namespaces (EF 6 usage) and overriding

protected override void OnModelCreating(ModelBuilder modelBuilder)

in your dbcontext for relation handling instead of original

class EntityNameMap : EntityTypeConfiguration<EntityName>

configuration file coming from EF6.




回答7:


step 1- download Entity Framework Power Tools from https://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d.

step 2- change download file extension from .vsix to .zip.

step 3- Extract .zip and open extension.vsixmanifest(xml file) and add following under supported tags and save.

<VisualStudio Version="14.0">
    <Edition>Pro</Edition>
  </VisualStudio>

Note:- doesn't matter you have any other edition.

step 4- now Select the files in the extracted folder and zip them. Don’t zip the folder.

step 5- now change the folder name and extension (example as EFPowerTools15.vsix).

Step 6- you should try to install created tool only from Administrator account. otherwise you still won't be able to install it.




回答8:


You can simply follow this 2 step-

  1. Download the file from here.

  2. Follow this video tutorial (please run code snippet to see the tutorial) -

<iframe width="100%" height="300" src="https://www.youtube.com/embed/yQN2Iuqb8kw" frameborder="0" allowfullscreen></iframe>

Re-

More can be found here (written tutorial).


If any problem of viewing the tutorial, please follow this link for tutorial.

I think, this is enough for installing and it will solve your problem :)



来源:https://stackoverflow.com/questions/27999235/how-to-use-entity-framework-power-tools-in-visual-studio-2015

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!