3

What exactly is the minimum requirement to get a .NET 4.6 application working with Oracle?

We are already using the Oracle.ManagedDataAccess client. We are using the Entity Framework and also DataSets (TableAdapters,...) for data access.

Currently we always install the "full" Oracle Administrator client for our applications which has about 1,2 GB, but what is really necessary to make our application(s) working with Oracle?

The Nuget page of the Oracle.ManagedDataAccess driver says "No additional Oracle Client software is required to be installed to connect to Oracle Database." https://www.nuget.org/packages/Oracle.ManagedDataAccess/

But when I open my application in Visual Studio I get the following error:

The ADO.NET provider with invariant name 'Oracle.ManagedDataAccess.Client' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details.

I tried to figure it out in the Oracle documentation, but no chance to do so, it's so confusing.

Furthermore: A 64-bit Managed Oracle Client is also working with 32 bit applications and the other way around?

Pinzi
  • 293
  • 6
  • 18

1 Answers1

0

I do not have Oracle available to me now to verify that this is exactly correct, so apologies in advance. you may need to adjust version numbers or public key token etc.

<configuration
  <system.data>
    <DbProviderFactories>
      <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </DbProviderFactories>
  </system.data>
</configuration>

The above configuration will register the managed Oracle driver as a provider and should resolve your issue. Installing the full Oracle client is not necessary, as the managed driver is fully contained. 32bit and 64bit does not matter since it's all in managed code anyways.

Note that the managed driver does not install tooling needed for various designers in Visual Studio used by Database First. You would need the full Oracle client for that. If you're doing Code First you don't have to worry about it.

mason
  • 31,774
  • 10
  • 77
  • 121
  • So this means for production systems I only need to add your xml to my web.config and thats it? Nothing else is required? For the development machines: Is it enough when we install the "Oracle Developer Tools for Visual Studio"? – Pinzi Mar 27 '17 at 19:52
  • @Pinzi It's been a while since I messed with it, but I believe those Oracle Developer Tools are only necessary if you're doing Database First. If you're doing Code First (which I strongly recommend) then you only need to the managed driver, nothing else, on your dev machine. – mason Mar 27 '17 at 20:12
  • Thank you very much, it is working without installing any additional clients. @Database/Code First: Unfortunately code first is not an option for us as we already have an existing database which we need to continue to use. – Pinzi Mar 27 '17 at 20:20
  • @Pinzi Code First doesn't mean it doesn't work with an existing database. It just means that you'll need to generate your model classes and relationships manually rather than using EDMX. A bit of a pain when you have a large existing database, but far easier than working with EDMX in the long run. – mason Mar 27 '17 at 20:24
  • @Pinzi And speaking as someone who has used Oracle with Entity Framework....it was painful. Stupid differences like how it handles case sensitivity in table names can be a real pain. If I were you, I don't know that I'd use EF with Oracle. Depending on the scale of what you're doing, a micro ORM such as Dapper or PetaPoco might be better. – mason Mar 27 '17 at 20:32
  • Ok, thank you for the info, the problem is we are already far too dependent of the EF to replace it. So far we had not really many big problems. – Pinzi Mar 27 '17 at 20:53