问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/43054955/net-4-6-oracle-manageddataaccess-requirements