实体框架与生产和开发数据库一起工作 [英] Entity framework working with both production and development database

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

问题描述

我要开始一个新项目,我想先尝试EF模型,我想要能够在MSSQL中使用开发数据库,​​并在MySQL中有一个生产数据库。



有没有人有这方面的经验?这可能吗?



我已经阅读了关于实体设计师数据库生成电源包。是否支持这一点?



我希望将创建的列和表添加到我的生产(MySQL)和开发数据库都很简单。

解决方案

由于数据库的类型是EDMX文件的一部分(模型第一),这将无法正常工作。您将需要两个不同的EDMX文件,具有相同的实体但不同的存储定义(EDMX文件的SSDL部分)。您还需要在您的开发机器上使用MySql提供程序(我不知道这也需要MySql本身)。最后,您将使用正确的EDMX文件中的元数据来使用不同的连接字符串。



这个整体是一个很糟糕的主意,因为你还必须对MySQL进行测试。您将在一个数据库服务器上开发应用程序的想法,它将仅在另一个数据库服务器上运行是不完全正确的。


I am going to start a new project and i want to try EF model first and i want to be able to work with a development database in MSSQL and have an production database in MySQL.

Is there anyone out there with experience in this? Is this possible?

I have read about Entity Designer Database Generation Power Pack. Does it support this?

I want it to be simple to add columns and table created to the model to both my production (MySQL) and development database.

解决方案

This will not work because type of the database is part of EDMX file (model first). You will need two different EDMX files with same entities but different storage definition (SSDL part of EDMX file). You will also need MySql provider on your development machine (I'm not sure it this also demands MySql itself). And for last you will need different connection strings using metadata from correct EDMX file.

This whole is pretty bad idea because you must still test your application against MySQL. The idea that you will develop application on one database server and it will just work on another is not entirely correct.

这篇关于实体框架与生产和开发数据库一起工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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