使用 Oracle 数据库的实体框架数据库优先

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22293952/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:16:26  来源:igfitidea点击:

Entity Framework Database-First with Oracle Database

oracleentity-framework

提问by Emad Mokhtar

I'm developing an ASP.NET WebForms application with Entity Framework Database-First connected with SQL Server, and I want to connect the same Entity Data Model with Oracle Database.

我正在开发一个带有实体框架数据库的 ASP.NET WebForms 应用程序 - 首先与 SQL Server 连接,我想将相同的实体数据模型与 Oracle 数据库连接。

My concerns are:

我的担忧是:

  • How to install Oracle Database Engine on my dev machine to test?
  • How to connect the data model with Oracle instead of SQL Server?
  • How to generate the same schema into Oracle?
  • Are there drivers, tools, or apps I need to install?
  • 如何在我的开发机器上安装 Oracle 数据库引擎进行测试?
  • 如何将数据模型连接到 Oracle 而不是 SQL Server?
  • 如何在 Oracle 中生成相同的模式?
  • 是否需要安装驱动程序、工具或应用程序?

回答by Ashutosh

I am doing exactly the same as you

我和你做的完全一样

i.e. Converting a ASP.NET MVC application on SQL server to Oracle.

即将 SQL 服务器上的 ASP.NET MVC 应用程序转换为 Oracle。

Since your application is already running, what you can do, is

由于您的应用程序已经在运行,您可以做的是

  1. generate create scripts from your SQL Server database,
  2. create the same tables in Oracle.
  3. Install ODP.NET from here. This will allow you to connect to Oracle from a .NET application.
  4. Now create a new edmxfile from the tables in Oracle and if you do everything properly, your application should be running.
  1. 从您的 SQL Server 数据库生成创建脚本,
  2. 在 Oracle 中创建相同的表。
  3. 这里安装 ODP.NET 。这将允许您从 .NET 应用程序连接到 Oracle。
  4. 现在edmx从 Oracle 中的表创建一个新文件,如果一切正常,您的应用程序应该正在运行。

Note: ODP.NET provider is only visible if you have a VS license. It is not visible on the free version.

注意:仅当您拥有 VS 许可证时,ODP.NET 提供程序才可见。它在免费版本上不可见。