实体框架:现有的数据库 - >数据模型 - >新的数据库 [英] Entity Framework: existing database -> data model -> new database

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

问题描述

我创建了一个新的项目MVC3和使用ADO.NET实体数据模型映射出我的现有数据库。它的工作太棒了。

I have created a new MVC3 project and used the ADO.NET Entity Data Model to map out my existing database. It worked great.

现在,这是一个数据库,我不想做我的web应用程序开发时的影响,所以我一直在寻找,现在附上数据模型到本地数据库(没有选择了一个没有,建议表示欢迎。我想的SQL Server CE或MySQL)。

Now, that is a database I don't want to affect when doing development of my web app, so I was looking to now attach that data model to a local database (haven't selected one yet, suggestions welcome. I was thinking SQL Server CE or MySQL).

有没有人对如何做到这一点任何想法?我会是不错的现有连接字符串保存到我的活动数据库,以及这种发展数据库环境。

Does anyone have any ideas on how to do this? I'd be nice to keep the existing connection string to my live database as well as this development database environment.

推荐答案

您可以使用任何你想要的技术(虽然这将是很好的,让他们像您的生产DB)生成另一个匹配DB,然后有一个Web.Debug和Web.Release设置。

You can generate another matching DB using whatever technology you want (though it would be good to keep them similar to your production DB) and then have a Web.Debug and a Web.Release setup.

如果你看一下换出的配置,web.config文件的连接字符串部分,你可以轻松地从发展交换到生产。

If you look at swapping out the configuration, connection string portion of your web.config file you can easily swap from development to production.

http://msdn.microsoft.com/en-us/library/ dd465326.aspx

这提供了在Web.config文件转换报表的相关信息,但是从它的声音,你可以简单地交换你的web.config的连接部分,并得到你想要的。

This provides the relevant information for the transform statements in your Web.config file, but from the sounds of it you can simply swap the connection portion of your web.config and get what you want.

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

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