是否有实体框架 7 数据库优先 POCO 生成器? [英] Is there an Entity Framework 7 Database-First POCO Generator?

查看:27
本文介绍了是否有实体框架 7 数据库优先 POCO 生成器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在为我正在处理的新项目使用 Entity Framework 7 和 ASP.NET 5,但我遇到了障碍.我工作的团队使用 DBA 优先的开发方法;即数据库由 DBA 设计,然后开发人员更改代码以补偿模型更改.

I've been playing around with Entity Framework 7 and ASP.NET 5 for a new project I'm working on, but I've hit a roadblock. The team I'm working on uses a DBA-first approach to development; i.e. the database is designed by DBA's and then the developers alter the code to compensate for the model changes.

使用 EF6,这很有效,因为我们可以使用 EDMX 设计器的更新"功能更新代码.一键,我们得到新的类,我们就完成了.但是,在 EF7 中,一切都不同了.没有更多的设计器,我们应该使用 Code-First,根据 EF 团队的一些博客文章,它也应该支持数据库优先"代码生成.

Using EF6, this works well, since we can just update the code using the EDMX designer's "update" functionality. One click, we get the new classes, and we're done. However, in EF7, everything is different. There's no more designer, and we're supposed to use Code-First, which according to some blog postings out there by the EF team, should also support "Database-First" code generation.

但是,我无法弄清楚如何在 ASP.NET 5 应用程序中使用 Visual Studio 2015 CTP6 执行此操作.是否有工具支持,还是我不走运?它甚至会来吗?

However, I'm unable to figure out how to do this with the Visual Studio 2015 CTP6 in an ASP.NET 5 application. Is the tooling support there yet, or am I out of luck? And is it even coming at all?

推荐答案

在最新版本中,可以使用 dnx 命令提示符和 PowerShell 命令来执行此操作,是的

In the latest bits it is possible to use the dnx command prompt and PowerShell commands to do this, yes

Scaffold-DbContext '<connectionString>' EntityFramework.MicrosoftSqlServer

dnx ef dbcontext scaffold "<connectionString>"  EntityFramework.MicrosoftSqlServer

或(来自 EF Core RC2)

or (from EF Core RC2)

dotnet ef dbcontext scaffold "<connectionString>"  Microsoft.EntityFrameworkCore.SqlServer

您必须安装 Microsoft.EntityFrameworkCore.Tools 包,命令才能工作.

You must install the Microsoft.EntityFrameworkCore.Tools package for the command to work.

这篇关于是否有实体框架 7 数据库优先 POCO 生成器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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