Entity Framework 4.1 仅逆向工程代码
我正在使用 Entity Framework 4.1,并希望利用其纯代码方法。在位于 http://channel9.msdn.com/Events/TechEd/ 的视频中Europe/2010/DEV212 从 35:00 分钟开始,他们展示了一个可以从现有数据库对 POCO 进行逆向工程的工具。我想这样做,因为我有一个现有的数据库。我已经安装了 EF 4.1,并且可以很好地创建 POCO 实体,但我似乎找不到他们用于从现有数据库创建 POCO 的工具。这个工具不是随4.1一起发布的吗?
提前致谢。
I am using Entity Framework 4.1 and want to take advantage of their code-only approach. In the video located at http://channel9.msdn.com/Events/TechEd/Europe/2010/DEV212 starting at 35:00 minutes in they show a tool that reverse engineers their POCOs from their existing database. I want to do this as I have an existing database. I have installed EF 4.1 and I can create POCO entities just fine but I can't seem to find the tool they used to create POCOs from the existing database. Was this tool not released with 4.1?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
该工具名为 EF电动工具CTP1。
The tool is called EF Power Tools CTP1.
如果您的数据库是 SQL Server 或 SQL CE 4.0,则可以使用 visualstudiogallery.msdn.microsoft.com
If your database is SQL Server, or SQL CE 4.0 then you can use the "Entity Framework Reverse POCO Generator" available at visualstudiogallery.msdn.microsoft.com
更新:
这个答案不再相关,因为 EF 5+ 具有代码优先迁移工具的完整功能。
我已经放弃了代码优先一段时间,因为它似乎没有我希望的那样功能齐全。最近,我有一些时间更多地使用 EF 4.1 并更详细地研究它。我真正相信他们现在缺乏的是数据/模式迁移能力。这种数据库的删除和重新创建并不是很理想。
在我的检查中,我发现我在这个问题中要求的工具确实是随 EF 4.1 一起提供的。它是一个名为“ADO.NET DbContext Generator”的代码生成模板。可以通过打开现有的 EDMX 文件、右键单击设计图面并选择“添加代码生成项”来找到它。
Update:
This answer is no longer relevant as EF 5+ is completely full-featured with code-first migration tools.
I had abandoned code-first for a while because it did not appear to be as full-featured as I had hoped. Recently I had some time to play with EF 4.1 a little more and examine it in more detail. All I really believe they are lacking now is a data/schema migration ability. This dropping and recreating of the database is not very ideal.
In my examination I found that the tool I am asking for in this question was indeed shipped with EF 4.1. It is a code generation template called "ADO.NET DbContext Generator". It can be found by opening up your existing EDMX file, right-clicking your design surface, and selecting "Add Code Generation Item".