Entity Framework with Oracle

3

I'm trying to use EF, using Code Frist, along with an Oracle database, so I'm using the Nuget package Oracle.ManagedDataAccess.EntityFramework , however whenever I try to run Update-Database it gives the following error message:

  

System.Runtime.Serialization.SerializationException: Type is not   resolved for member   'Oracle.ManagedDataAccess.Client.OracleException, Oracle.ManagedDataAccess,   Version = 4.122.1.0, Culture = neutral, PublicKeyToken = 89b483f429c47342 '.

     

at System.AppDomain.DoCallBack (CrossAppDomainDelegate   callBackDelegate) at   System.Data.Entity.Migrations.Design.ToolingFacade.Run (BaseRunner   runner) at   System.Data.Entity.Migrations.Design.ToolingFacade.Update (String   targetMigration, Boolean force) at   System.Data.Entity.Migrations.UpdateDatabaseCommand.

asked by anonymous 14.07.2017 / 04:54

1 answer

3

Unfortunately, even though I really like the Oracle database, I do not recommend using EF Migrations with Oracle. They do not give proper attention to their provider and always have several problems like this one. I worked with EF + Oracle for almost 2 years, and I was never 100% happy. And apparently not much has changed that scenario.

I recommend changing your Database Update strategy to Change Scripts instead of Migrations .

If you are working with an application that will be hosted in VM, you can install the Oracle dll in the GAC. But if you are hosting in PaaS - where you will not have access to the host, you can only publish applications - it is no longer an option.

C:\Windows\system32>cd E:\smn\packages\Oracle.ManagedDataAccess.12.1.021\lib\net40

C:\Windows\system32>e:

E:\smn\packages\Oracle.ManagedDataAccess.12.1.021\lib\net40>"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe" /i Oracle.ManagedDataAccess.dll
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.33440
Copyright (c) Microsoft Corporation.  All rights reserved.

Assembly successfully added to the cache

Snippet copied from this response .

    
14.07.2017 / 09:36