使用实体框架针对数据库项目进行编程
我正在使用 Visual Studios 2010 创建一个具有数据库的项目。
我决定尝试使用那些允许您在源代码管理中管理数据库以及代码的数据库项目之一。
我还认为我会使用实体框架作为我的数据访问工具。
是否有任何好的解决方案可以将 EF 4.0 项目与数据库项目中管理的数据库联系起来(假设它是一个新数据库)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只需使用数据库项目为您创建数据库,然后将数据库优先方法与实体框架结合使用(这意味着您将使用向导和从数据库更新为您创建实体模型)。
You simply use your database project to create database for you and you use Database first approach with Entity framework (that means you will use wizard and update from database to create entity model for you).
我发现 Scott Guthries 的“代码优先”教程非常好:
http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx
让我知道是否不太能解决问题,我还收藏了其他几个。
I found Scott Guthries 'Code-first' tutorial to be quite good:
http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx
Let me know if that doesn't quite scratch the itch, I've got a couple of others bookmarked.