如何在 Visual Studio 2015 中使用 Entity Framework Power Tools? [英] How to use Entity Framework Power Tools in Visual Studio 2015?

查看:19
本文介绍了如何在 Visual Studio 2015 中使用 Entity Framework Power Tools?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Visual Studio 2012 中使用了实体框架.通过逆向工程代码优先"构建实体模型.

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

但是,当我刚刚设置 Visual Studio 2015 并通过 NuGet 设置 EF 电源工具时,我找不到先逆向工程代码"选项.

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?

谢谢!

推荐答案

Entity Framework Power Tools 是一个 Visual Studio extension,所以需要先安装.但是,有一个问题,Visual Studio 支持的版本是 2010、2012 和 2013.Visual Studio 2015 是预览版.我认为这就是它尚未包括在内的原因.但我有一个适合我的解决方案,以防万一.

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. 下载实体框架强力工具
  2. .vsix 文件是一个 zip,因此您可以使用 Winrar(或任何其他具有此功能的程序)解压缩它.仅解压缩名为 extension.vsixmanifest
  3. 的文件
  4. 在这个文件(它是一个 xml)中,您需要找到一个名为 SupportedProducts 的标签并添加 Visual Studio 2015 版本(转到 Help->About Microsoft Visual Studio 检查您安装的版本).

  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>

  • 覆盖 .vsix 中的 extension.vsixmanifest 文件,然后尝试安装.

  • Overwrite the extension.vsixmanifest file in the .vsix, and try to install that.

    希望对您有所帮助

    我尝试使用该配置(版本:14.0 和版本:Ultimate)并且有效.为了节省时间,您可以在此链接.我还添加了社区版.

    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.

    Julie Lerman 写了一篇文章 也介绍了如何解决此问题.

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

    我强烈建议使用 EntityFramework Reverse POCO Generator当您使用旧数据库时.如果您的架构可以在不使用迁移的情况下多次更改,那么最好使用 t4 模板,它可以帮助您在每次更新数据库时重新生成模型.您唯一需要做的就是右键单击您的 .tt 文件并执行运行自定义工具选项,仅此而已.EF Power Tools 还提供一个选项,允许您自定义 t4 模板.

    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.

    这篇关于如何在 Visual Studio 2015 中使用 Entity Framework Power Tools?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆