如何使用相同模型(MVC)对于MS-SQL DB和Oracle DB? [英] How to use Same Model(MVC) For MS-SQL DB and Oracle DB?

查看:53
本文介绍了如何使用相同模型(MVC)对于MS-SQL DB和Oracle DB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用EF5在数据库MSSQL Server2012的MVC4应用程序中工作

应用程序中使用的conncetion字符串:

I am working in MVC4 application with database MSSQL Server2012 using EF5
conncetion string used in the application:

<add name="INEEntities" connectionString="metadata=res://*/Models.INEModel.csdl|res://*/Models.INEModel.ssdl|res://*/Models.INEModel.msl;provider=System.Data.SqlClient;provider connection string="data source=SADIQUE-PC\MSSQLSERVER2012;initial catalog=INE;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />





现在

我想用oracle同一个应用程序的数据库(DB从MSSQL成功迁移到oracle)



我该怎么做?应该在连接字符串中进行哪些更改。?

模型中是否需要进行任何更改?

帮助Plz ..



Now
I want to use oracle database for the same application(DB is migrated to oracle from MSSQL successfully)

How can I do that ? what changes should be done in connection string.?
Is any changes needed in Model?
Help Plz..

推荐答案

尝试以下一个(样本):



方法1:



Try below one (sample) :

Method 1:

<connectionStrings>
    <add name="VoccDbContext" connectionString="metadata=res://*/Entities.Vocc.VoccModel.csdl|res://*/Entities.Vocc.VoccModel.ssdl|&#xD;&#xA;        res://*/Entities.Vocc.VoccModel.msl;provider=Oracle.DataAccess.Client;provider connection string=&quot;DATA SOURCE=sameDbName;PASSWORD=somePass;USER ID=someUser;&quot;"         providerName="System.Data.EntityClient" />
</connectionStrings>







查看此内容以获取更多信息:



http://stackoverflow.com/questions/11544191/connection-string-for-oracle-using-entity-framework-and-ldap [ ^ ]



方法2:






Check this for more :

http://stackoverflow.com/questions/11544191/connection-string-for-oracle-using-entity-framework-and-ldap[^]

Method 2:

<add name="MyEntities" connectionString="metadata=res://*/OracleModel.csdl|res://*/OracleModel.ssdl|res://*/OracleModel.msl;provider=Oracle.DataAccess.Client;provider connection string=&quot;DATA SOURCE= (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = MY-SERVERNAME-OR-IP)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = PRODUCTION) ) );PASSWORD=MySecret*1;PERSIST SECURITY INFO=True;USER ID=JAMES.BOND&quot;" providerName="System.Data.EntityClient" />





查看此内容以获取更多信息:



http://shanthuk.com/2013/01/13/entity-framework- oracle-connection-string / [ ^ ]



我希望这会对你有所帮助。



Check this for more :

http://shanthuk.com/2013/01/13/entity-framework-oracle-connection-string/[^]

I hope this will help to you.


这篇关于如何使用相同模型(MVC)对于MS-SQL DB和Oracle DB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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