简体   繁体   English

在oracle odp.net上使用实体farmework6

[英]using entity farmework6 with oracle odp.net

i use entity framework 6 with ODTwithODAC1120320_32bit entity frameworkd version is 6.1.1 (get by NuGet) and i use entity framework power tools beta4 create the models and mappers. 我使用ODTwithODAC1120320_32bit的实体框架6,实体框架版本为6.1.1(由NuGet获取),并且我使用实体框架电动工具beta4创建模型和映射器。

when run the program: The Entity Framework provider type 'Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess' registered in the application config file for the ADO.NET provider with invariant name 'Oracle.DataAccess.Client' could not be loaded. 运行程序时:无法加载在ADO.NET提供程序的应用程序配置文件中注册的实体框架提供程序类型'Oracle.DataAccess.Client.OracleClientFactory,Oracle.DataAccess',其名称为'Oracle.DataAccess.Client'。 Make sure that the assembly-qualified name is used and that the assembly is available to the running application. 确保使用了程序集限定名称,并且该程序集可用于正在运行的应用程序。 See http://go.microsoft.com/fwlink/?LinkId=260882 for more information. 有关更多信息,请参见http://go.microsoft.com/fwlink/?LinkId=260882

context is: public partial class Context : DbContext { static Context() { Database.SetInitializer(null); 上下文是:公共局部类上下文:DbContext {静态Context(){Database.SetInitializer(null); } }

    public Context()
        : base("Name=Context")
    {
    }
    public DbSet<S_USER> S_USER { get; set; }
    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Configurations.Add(new S_USERMap());
    }
}

First of all, you'll need to download the latest (12.1) ODP.NET beta if you want to use EF 6 code first or code first Migrations. 首先,如果要先使用EF 6代码或先使用代码Migrations,则需要下载最新的(12.1)ODP.NET beta。 The 11.2.0.3.20 release does not support that. 11.2.0.3.20版本不支持该功能。

You can get the beta here: http://www.oracle.com/technetwork/topics/dotnet/downloads/index-2235287.html 您可以在此处获得测试版: http : //www.oracle.com/technetwork/topics/dotnet/downloads/index-2235287.html

Second of all, the error you are receiving can happen when ODP.NET is not installed properly. 第二,如果未正确安装ODP.NET,则可能会发生接收到的错误。 Certain entries must be added to the machine.config. 某些条目必须添加到machine.config中。 To fix that, I would try reinstalling. 要解决此问题,我将尝试重新安装。 Also keep in mind that there is a 32-bit and a 64-bit machine config. 还请记住,有一个32位和64位计算机配置。 There should be a config tool in the ODP.NET oracle home for configuring the 64-bit machine.config if that is the target you are building. 如果这是您要构建的目标,则ODP.NET oracle主页中应该有一个配置工具,用于配置64位machine.config。 Or you can download and install the 64-bit ODP.NET which will do the same. 或者,您可以下载并安装将执行相同操作的64位ODP.NET。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM