如何在Visual Studio 2015中添加EntityObject Generator? [英] How to add EntityObject Generator in Visual Studio 2015?

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

问题描述

我在VS2015中安装了最新的实体框架版本(EntityFramework.6.1.3).我已经在项目中添加了EF,并从DBContext中删除了2个.tt文件( edmx_file_name.tt edmx_file_name.Context.tt ).

I have installed the latest Entity Framework version (EntityFramework.6.1.3) in VS2015. I have added the EF in the project and deleted the 2 .tt files (edmx_file_name.tt and edmx_file_name.Context.tt) as they were from the DBContext.

现在,我正在尝试通过在EF设计器中打开模型来添加EF 6.x代码生成模板,右键单击设计图面,然后选择添加代码生成项.

Now I am trying to add the EF 6.x code generation template by open the model in the EF Designer, right-click on the design surface and select Add Code Generation Item.

要在ObjectContext中添加代码生成,我需要安装EF 6.x EntityObject Generator.我是从此处下载的.

To add the Code Generation in ObjectContext i need to install the EF 6.x EntityObject Generator. I downloaded it from here.

但是我无法在VS 2015中安装它.

But it I couldn't install it in VS 2015.

我该如何解决?

推荐答案

到目前为止,Visual Studio 2015不支持EntityObject Generator模板,替代解决方案是,使用Visual Studio 2013打开解决方案,然后打开edmx图,右键单击,选择添加代码生成项",您将看到"EF 6.X EntityObject Generator",如果看不到,请转到在线"菜单,然后会看到用于C#的EF 6.x EntityObject Generator". "展示.选择EntityObject Generator,然后单击添加"按钮将其添加到您的数据访问层项目中. tt将为您自动生成EntityObject类.保存该项目,退出Visual Studio2013.使用Visual Studio 2015重新打开该解决方案.完成.

Since until now, no EntityObject Generator Template is supported in Visual Studio 2015, the alter solution is, open your solution with Visual Studio 2013, then open your edmx diagram, right click, select "Add Code generation Item", you will see "EF 6.X EntityObject Generator", if you cannot see it, go to "online" menu, and you will see "EF 6.x EntityObject Generator For C#" display. Select the EntityObject Generator and click "Add" button to add it to you data access layer project. The tt will auto generate EntityObject classes for you. Save the project, exit visual studio 2013. Reopen the solution with visual studio 2015. Done.

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

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