现有数据库的实体框架 [英] Entity Framework for Existing Database

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

问题描述

我的要求是我在远程位置有一个现有的SQL数据库。我无法访问此数据库。我必须创建一个程序,将安装在这个位置,然后必须使用该程序通过这个数据库并获取一些信息并将其存储在excel中。



我的问题是我可以使用实体框架吗?如果是,那么我应该使用哪种方法,代码优先或空模型?

My requirement is that I have an existing SQL database at a remote location. I cannot access this database. I have to create a program which will be installed at this location which in turn has to be used to go through this database and get some information and store it in an excel.

My question is can I use entity framework for this? If yes, then which approach should I use, Code-first or empty model?

推荐答案

由于你已经在另一端创建了数据库,最简单,最快的将是使用脚本在您的最后创建包含样本数据的BD。然后使用EF与数据库第一种方法。



创建一个脚本来重新创建数据库:

http:// blog.sqlauthority.com/2012/07/18/sql-server-generate-script-for-schema-and-data-sql-in-sixty-seconds-021-video/ [ ^ ]



和EF数据库第一种方法:

http://www.entityframeworktutorial.net/database-first-with-entity-framework.aspx [ ^ ]



谢谢。
Since you have DB already created at another end, the easiest and quickest would be take the script to create BD with sample data at your end. And then use EF with database first approach.

To create a script to re-create DB with Data:
http://blog.sqlauthority.com/2012/07/18/sql-server-generate-script-for-schema-and-data-sql-in-sixty-seconds-021-video/[^]

and EF Database first approach:
http://www.entityframeworktutorial.net/database-first-with-entity-framework.aspx[^]

Thanks.


这篇关于现有数据库的实体框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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