实体框架7逆向工程ASP.NET 5 [英] Entity Framework 7 Reverse Engineering ASP.NET 5
问题描述
我一直在尝试使用EF7到我的数据库迁移到Web应用程序模型_4。
I have been trying to migrate my database into web app model using EF7 _4.
夫妇的事情,我意识到是语法/方法如何配置特定的实体已被更改。
Couple things I realized is that the syntax/approach how to configure particular entities has been changed.
通常你用EF电动工具(EF6),从而产生实体类型和实体地图作为配置生成POCO类。所有的清洁,所有的作品。
Normally you generate POCO classes by using EF Power Tools (EF6), which generates entity types and entity map as configuration. All clean, all works.
我的问题是,是否有人的经验如何与EF7办呢?
从MSDN博客我已经在这里找到关于<一个href=\"http://blogs.msdn.com/b/adonet/archive/2015/04/29/entity-framework-and-visual-studio-2015-rc.aspx\"相对=nofollow>实体框架7 Beta 4的
From the msdn blog I have found here about Entity Framework 7 Beta 4
逆向工程的功能仍然在开发阶段。 逆向工程的早期preVIEW一个从数据库模型
the features for reverse engineering are still on dev phase. "An early preview of reverse engineering a model from a database".
推荐答案
下面的东西,将让你对你的方式。正如你所知道的一切还是测试版,这是一个有点复杂,但最好我们的时刻。
Here is something that will get you on your way. As you know its still all beta and this is a little complex but the best we have at the moment.
<一个href=\"http://stoutcloud.com/geek-out-entity-framework-7/geek-ef7-reverse-engineering-first-look/\">http://stoutcloud.com/geek-out-entity-framework-7/geek-ef7-reverse-engineering-first-look/
只是一些命令,一路上帮助,因为他们改变了一点,因为它改成DNX。您可以进入命令提示符或PowerShell的。
Just some commands to help along the way, since they changed a little since it changed to DNX. You can go into the command prompt or Powershell.
首先,确保你安装相关的实体框架包(如上述文章中所述)。确保你得到最新的,而不是β1的。我发现它需要匹配DNX的测试数量。例如。如果你得到DNX beta5的,你需要下载每晚构建beta5的EF的的。
First make sure you install the relevant entity framework packages (as described in the above article). Make sure you get the latest and not beta1. I have found it needs to match the beta number of the DNX. E.g. if you get DNX beta5 you need to download the nightly builds of EF of beta5.
每晚构建,以供参考的NuGet包源: https://www.myget.org/F/aspnetvnext/api / V2
Nightly build NuGet package source for reference: https://www.myget.org/F/aspnetvnext/api/v2
不要忘了添加到您的project.json
Don't forget to add this to your project.json
"commands": {
"ef": "EntityFramework.Commands"
}
现在到命令
dnvm install -r coreclr latest
(或只使用CLR,如果你不希望coreClr)
(or just use clr if you don't want the coreClr)
走进项目目录,然后键入
Go into the project directory then type
dnu restore
dnx . ef
dnx . ef revEng Server=PC\SQLEXPRESS;Database=Databasename;Trusted_Connection=True;
我听说他们正在为这样的GUI,所以我们将不得不等待和观望。
I have heard they are working on a GUI for this so we will just have to wait and see.
这篇关于实体框架7逆向工程ASP.NET 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!