Oracle Instant Client and Entity Framework trouble with configuration - c#

I'm trying to learn and figure out if it is possible to deploy an MVC, EF, ODAC 11.2.0.3 app to a server that has a previous version of ODP.NET installed. Rather than updating the sever ODP.NET (which I can't), I figured I could use the Oracle Instant Client.
Is this doable?
1) I added these dlls to my project to support Instant Client
-Oracle.DataAccess.dll
-oci.dll
-ociw32.dll
-orannzsbb11.dll
-oraociei11.dll
-OraOps11w.dll
2) Next I updated web.config for the dbProviderFactories
<system.data>
<DbProviderFactories>
<add name="Oracle Data Provider for .NET"
invariant="Oracle.DataAccess.Client"
description="Oracle Data Provider for .NET"
type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
3) This (afaik) is how to use the Oracle dll in the bin rathre than the GAC
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342" />
<publisherPolicy apply="no" />
</dependentAssembly>
</assemblyBinding>
</runtime>
4) Finally my connectionString
<connectionStrings>
<add name="Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=Oracle.DataAccess.Client;
provider connection string="DATA SOURCE=XXX;PASSWORD=XXX;PERSIST SECURITY INFO=True;USER ID=XXX"" providerName="System.Data.EntityClient" />
</connectionStrings>
This is the error I receive
Unable to find the requested .Net Framework Data Provider. It may not be installed.
I really appreciate any help here. I'm rather new and have a lot to learn. Thanks in advance. cheers

Add a <remove … /> section in the <DbProviderFactories> element in the web config to remove any existing Oracle provider. (before the <add>)
<remove invariant ="Oracle.DataAccess.Client" />

It seems from your question that you need to deploy an update to your application and the new version of ODP.net using only xcopy deployment permission.
Since your application is being changed, then you shouldn't need the assembly binding changes or DbProviderFactories.
Just update the csproj of the class library with your edmx etc to have a reference to the new ODP.net version, eg
<Reference Include="Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86" />
If you get an issue with your tnsnames.ora, then you would have to do one of the following:
a) Add a system environment variable TNS_ADMIN to point to the directory of the tnsnames.ora, or
b) Change the connection string to something based on:
Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;
c) See if you can put a copy of the tnsnames.ora somewhere else.

Here is my Xcopy solution.
I posted it over at
(https://jeremybranham.wordpress.com/2011/04/25/oracle-instant-client-with-odp-net/#comment-181)
as well.
But I think I can post my xml without formatting issues here.
Nuget "packages.config"
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="1.0" targetFramework="net35" />
<package id="EnterpriseLibrary.Common" version="5.0.505.0" targetFramework="net35" />
<package id="EnterpriseLibrary.Data" version="5.0.505.0" targetFramework="net35" />
<package id="EntLibContrib.Data.OdpNet" version="5.0.505.0" targetFramework="net35" />
<package id="Unity" version="2.1.505.2" targetFramework="net35" />
<package id="Unity.Interception" version="2.1.505.2" targetFramework="net35" />
</packages>
app.config
(note the <clear /> tag below. this may or may not be needed, but I figured it was better to clear them out since you don't know what may be in the machine.config file)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<dataConfiguration defaultDatabase="OracleMainConnectionString">
</dataConfiguration>
<connectionStrings>
<add name="OracleMainConnectionString"
connectionString="Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyOracleServerName)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=MyServiceName)));User ID=MyUserName;Password=MyPassword;"
providerName="Oracle.DataAccess.Client" />
</connectionStrings>
<appSettings>
<add key="ExampleKey" value="ExampleValue" />
</appSettings>
<system.data>
<DbProviderFactories>
<clear />
<add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description=".Net Framework Data Provider for Oracle" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<add name="EntLibContrib.Data.OdpNet" invariant="EntLibContrib.Data.OdpNet" description="EntLibContrib Data OdpNet Provider" type="EntLibContrib.Data.OdpNet.OracleDatabase, EntLibContrib.Data.OdpNet, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null" />
</DbProviderFactories>
</system.data>
</configuration>
I am developing on a x64 Windows 7 machine.
I downloaded:
ODAC1120320Xcopy_32bit.zip
(from oracle.com)
Which is the:
ODAC 11.2 Release 5 (11.2.0.3.20) Download the XCopy version [Released September 11, 2012]
I unzipped this zip file.
I searched and fished out these files:
oci.dll
Oracle.DataAccess.dll
orannzsbb11.dll
oraociei11.dll
OraOps11w.dll
Note, when there were 2 files of the same name, I took the "bin\2.x\" or "odp.net20\bin" version for my 3.5 Framework need (I'm not on 4.0 yet).
I took these files, and put them in a subfolder from where my .sln file resides.
.\MySolution.sln
.\MyConsoleApplicationFolder\MyConsoleApp.csproj
.\ThirdPartyReferences\
.\ThirdPartyReferences\Oracle\
I place all the files above in the
.\ThirdPartyReferences\Oracle\
folder
I used "Add Reference" to add a reference to Oracle.DataAccess.dll to the "MyConsoleApp.csproj" csharp project.
(This meant browsing to "..\ThirdPartyReferences\Oracle\" of course)
I used a "Post Build Event" to copy the "extra" (aka, "accessory)" files
My lines in my post build event were:
copy $(ProjectDir)..\ThirdPartyReferences\Oracle\oci.dll $(TargetDir)*.*
copy $(ProjectDir)..\ThirdPartyReferences\Oracle\orannzsbb11.dll $(TargetDir)*.*
copy $(ProjectDir)..\ThirdPartyReferences\Oracle\oraociei11.dll $(TargetDir)*.*
copy $(ProjectDir)..\ThirdPartyReferences\Oracle\OraOps11w.dll $(TargetDir)*.*
Note, my post build event replaces the "Copy if Newer" from the URL instructions above.
When I ran my project........I got a few missing dll errors.
Note:
In the assembly that has your calls to the EnterpriseLibrary.Data objects…you’ll get “Cannot find Microsoft.Practices.SomethingSomething namespace. Just keep adding references to these dll’s (that the above package.config will pull down) until the errors go away.
Like here is a specific one:
"Could not load file or assembly 'Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."
So (after running Nuget of course, to download all the files)
I went and added a reference to:
\packages\CommonServiceLocator.1.0\lib\NET35\Microsoft.Practices.ServiceLocation.dll
That cleared up the issues.
And my csharp code: (note "select *" is for demo purposes only)
/*
using System;
using System.Data;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
*/
public IDataReader EmployeesGetAll()
{
IDataReader returnReader = null;
try
{
Database db = DatabaseFactory.CreateDatabase();
DbCommand dbc = db.GetSqlStringCommand("SELECT * FROM ( SELECT * FROM TEMPLOYEE ) WHERE ROWNUM <= 25");
returnReader = db.ExecuteReader(dbc);
return returnReader;
}
finally
{
}
}
And it worked.
Thank you:
https://jeremybranham.wordpress.com/2011/04/25/oracle-instant-client-with-odp-net/#comment-181
I think this makes ODP.NET an "xcopy" deployment.
I still need to test on a clean machine to be sure.
But its the end of the day..............
================
Additional Information:
Everything above is correct. However, I hit a caveat.
I was using a "Console Application" to test my code.
When you add a new Console Application to visual studio, it DEFAULTS to x86.
As seen here:
http://www.xavierdecoster.com/post/2011/02/15/console-application-visual-studio-gotcha-on-x64-os-aspx
EDIT: (Updated link)
http://www.xavierdecoster.com/post/2011/02/15/console-application-visual-studio-gotcha-on-x64-os
So when I put all the configuration and code and stuff in a real project (which was set to "Any CPU" on a x64 bit machine)...everything I had done stopped working. :<
After tweaking a bit........
I found this file on oracle.com
ODAC1120320Xcopy_x64.zip
I then repeated everything I did above , but searching the unzipped files of this x64 zip file.
Everything is working.
But that "x86" default thing with a Console application threw me for a loop.

I was getting the same error (data provider not found) when deploying ODP.NET via Instant Client. The only thing that I needed to do was to add the following to my exe.config file (inside the tag)
<system.data>
<DbProviderFactories>
<add name="Oracle Data Provider for .NET"
invariant="Oracle.DataAccess.Client"
description="Oracle Data Provider for .NET"
type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>

Related

.net Could not load file or assembly MySql.Data. Strong name validation failed (0x8013141A)

Error:
An unhandled exception of type 'System.IO.FileLoadException' occurred in WindowsFormsApplication4.exe
Additional information: Could not load file or assembly 'MySql.Data, Version=8.0.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
Information:
Visual Studio 2015
Windows 10 - x64
C#
MySQL 6.9.9
Problem:
I've made a class library using MySQL to run various queries to my online database.
After including the dll in my separate project, the only line of code I'm using is the following: (which it throws the exception on)
// Runs a simple select statement to find matches for 'John Doe' in my online MySQL database table... and stores results to a dataset
DataSet ds = MyDllNameSpace.Database.People.Load("John", "Doe");
App.Config files:
My dll project: (I did NOT sign this project)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=8.0.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data></configuration>
My separate project: (I did NOT sign this project)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.8.0" newVersion="8.0.8.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
What I've searched/tried:
Made sure to use the same version of MySQL in both projects
Put the dll to both my library and MySQL in the bin folder of my separate project and adding them as a reference
Also tried adding both dlls of my library and MySQL to the separate project and selecting 'always copy'
Changing around the App.config file (assuming the issue is in here?)
Lastly, I tried signing both the dll project, and the project using the dll with the same password (checking sign the assembly). This also did nothing. :(
Thank you
Have you tried signing the project(s)? That may remove your error.
Maybe this link about your error will help: https://blogs.msdn.microsoft.com/keithmg/2012/03/20/strong-name-validation-failed-exception-from-hresult-0x8013141a/
or this stackoverflow question:
Strong Name Validation Failed

MySQL and MVC Entity Framework in VS 2017 Not Working

I am trying to start an MVC EF Visual Studio 2017 project. I have my Data Connection all set up with MySQL on my local instance but when I go to create an ADO.net Data Model I get the error seen in the picture:
There was another article here: Can't use a MySQL connection for entity framework 6 that covered VS 2012 and 2013 but not 2017. Here is the MySQL documentation that says what versions work with 2017: https://dev.mysql.com/doc/visual-studio/en/visual-studio-install.html
I am using:
MySQL Connector Net 6.9.9 | MySQL for Visual Studio 1.2.7 | MySQL Server 5.7
MySQL.Data 6.9.9 | MySQL.Data.Entity 6.9.9 | Entity Framework 6.1.3
All of which are listed as tested and working by MySQL. I just installed all new everything today so there are no outstanding old versions. I triple checked ;)
Connection string:
<connectionStrings>
<add name="MySQL" connectionString="server=localhost;port=3306;user id=root;password=password;database=localdb" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
Edit
I have found this article https://dev.mysql.com/doc/connector-net/en/connector-net-entityframework60.html that talks about setting up the connection but now instead of that error, the dialog box just goes away as soon as I hit 'Next'.
Is this just me doing something incorrectly or a broken MySQL connector?
Thanks in advance for any advice!
What I had to do was reinstall MySQL for Visual Studio 2.0.5, then completely remove and install MySQL Connector 6.9.9. Seems the order does matter. After that, I completely remove these packages, and reinstalled in this exact order:
(restart Visual Studio afterward)
EntityFramework 6.1.3 (I tried earlier versions and they don't work, so beware)
Mysql.Data 6.9.9
Mysql.Data.Entity 6.9.9 (NOT Mysql.Data.Entities!!! [for 6.9.9])
Mysql.Web 6.9.9
Then, make sure the following is in your web.config file:
(restart after editing to be sure)
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
</providers>
</entityFramework>
(you may have to comment out any existing section and replace it with this one)
The last step I had to remind myself by revisiting here.
That part is what I forgot about (been too long), which caused the error in the screenshot in the question.
One last thing, you may have incorrect versions copied to where Visual Studio is installed; for example:
C:\Program Files (x86)\Microsoft Visual Studio\{Year}\{Community|Enterprise|Professional}\Common7\IDE\PrivateAssemblies
or
C:\Program Files (x86)\Microsoft Visual Studio {Your Version Number}\Common7\IDE\PrivateAssemblies
MySql.Data.dll
MySql.Data.Entity.EF6.dll
MySql.Web.dll
(may have to close Visual Studio first)
You can select each file and go to the Details tab under the file properties to see what versions you have.
Get the new files from here (or wherever you installed it):
C:\Program Files (x86)\MySQL\MySQL Connector Net 6.9.9\Assemblies\v4.5
(this assumes Connector v6.9.9 using framework v4.5 [see your project properties' Application->Target Framework to confirm your setting]).
Note 1: When you install MySQL for Visual Studio, it updates the files in the PrivateAssemblies folder (see the Visual Studio paths above), so PLEASE double check the assemblies above to make sure they didn't get changed to anything other than your target version (6.9.9 in this case). Regardless of what NuGet installs, Visual Studio won't even care, and will look in the private assemblies (I think during startup actually).
Note 2: If you get an "IsPrimaryKey" error, see here.
My completed App.Config that works for reference (to compare with yours):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
</providers>
</entityFramework>
<connectionStrings>
<!-- Connections Strings Go Here -->
</connectionStrings>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.9.9.0" newVersion="6.9.9.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
So eventually what I did was I created a new project and did a clean install of MySQL.Data 6.9.9 | MySQL.Data.Entity 6.9.9 | Entity Framework 6.1.3 and then tried to make the data model again.
It almost worked! I got an error saying: 'System.Data.StrongTypingException: The value for column 'IsPrimaryKey' in table 'TableDetails' is DBNull. ---> System.InvalidCastException: Specified cast is not valid. But lots of people have worked past this issue by going into the MySQL command line and executing: set global optimizer_switch='derived_merge=off' You can find this bug here: https://bugs.mysql.com/bug.php?id=79163
For whatever reason this works. here is the output of my command line to as to help any newbies at MySQL:
This fixes EVERYTHING! hopefully someone finds this an doesn't waste as much time as I did.
#James Wilkins Thanks for the detailed answer, I've to add, sometime when you are adding Mysql.data or MySQL.data.entity the assembly version doesn't match the assemblies installed by MySqlConnector/Net, as we often download the latest version from Nuget, this cause this issue again, so what I did and fixed the issue, I copied the dll (Mysql.data, MySQL.data.entity and web) from
C:\Program Files (x86)\MySQL\MySQL Connector Net 6.9.9\Assemblies\v4.5
to my application bin/debug folder and reference these instead of downloading from Nugets. This fixed my issues. You may also need to update the assembly version in app.config or web.config and packages.config file as well.
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.10.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
To
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
And update the version for the entries here in packages.config
<package id="MySql.Data" version="6.9.9" targetFramework="net452" />
<package id="MySql.Data.Entity" version="6.9.9" targetFramework="net452" />
<package id="MySql.Web" version="6.9.9" targetFramework="net452" />
Tuning in to confirm that I got everything working -including the db-first gui-tool-chain of Entity Framework in VS2017- on a .net 4.7.1 asp.net-mvc5 wev-solution by employing these exact components on Visual Studio 2017 (VS2017 => ver15.5.7 aka fully updated VS2017 at the time of this writing):
Entity Framework ver6.2.0 [nuget]
MySql.Data ver6.9.11 [nuget]
MySql.Data.Entity ver6.9.11 [nuget]
MySql.Web ver6.9.11 [nuget]
MySQL for Visual Studio ver2.0.5 [system-wide msi installer]
MySql-Connector ver6.9.11 [system-wide msi installer]
I tried using the latest MySql-Connector (ver.6.10.x) but it turned out that the gui tools of VS2017 for the db-first approach wouldn't work at all. I guess MySql-Connector has to be aligned with the rest of the dlls version-wise.
Web.config looks like so:
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
[...]
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
<parameters>
<parameter value="Data Source=.; Integrated Security=True; MultipleActiveResultSets=True;" />
</parameters>
</defaultConnectionFactory>
[...]
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
[...]
</providers>
[...]
</entityFramework>
[...]
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add description=".Net Framework Data Provider for MySQL" invariant="MySql.Data.MySqlClient" name="MySQL Data Provider" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" />
</DbProviderFactories>
</system.data>
[...]
</configuration>
And the App.config the child project hosting the .edmx file looks like so:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework" requirePermission="false" />
[...]
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
[...]
</providers>
</entityFramework>
[...]
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add description=".Net Framework Data Provider for MySQL" invariant="MySql.Data.MySqlClient" name="MySQL Data Provider" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" />
</DbProviderFactories>
</system.data>
[...]
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />
</startup>
</configuration>
And the packages.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.2.0" targetFramework="net471" allowedVersions="[6.2.0]" />
<package id="LinqKit" version="1.1.13" targetFramework="net471" allowedVersions="[1.1.13]" />
<package id="MySql.Data" version="6.9.11" targetFramework="net471" allowedVersions="[6.9.11]" />
<package id="MySql.Data.Entity" version="6.9.11" targetFramework="net471" allowedVersions="[6.9.11]" />
<package id="MySql.Web" version="6.9.11" targetFramework="net471" allowedVersions="[6.9.11]" />
</packages>
Note: The packages.config has been tweaked intentionally by means of [allowedVersions] to forbid unintentional auto-upgrades of MySql packages to their more recent versions. This was done due to dodge issues that plague the 6.10.x flavors of the MySql nugets.

Oracle.DataAccess FileNotFoundException

I'm doing asp.net mvc3, and I have a problem with ODP.NET, Oracle.DataAccess.
Whenever I try to do my unit test, it throws a FileNotFoundException.
I thought I've installed and been using Oracle.DataAccess v4.112.3.0, but my application keeps looking for 'Oracle.DataAccess, Version=4.121.1.0'.
Still I can find 'Oracle.DataAccess v4.112.3.0' in my GAC and through the FusionLog I found belows in my machine.config. So I guess there are some version conflict of ODP.NET.
<system.data>
<DbProviderFactories>
<add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<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.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
So, I've tried to modify the version in the machine.config but it didn't work.
Anyone can help me to fix this?
You can always force a specific version with a runtime redirect in web.config (or machine.config), provided the Oracle dll's interface across versions has stayed the same:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89B483F429C47342"/>
<bindingRedirect oldVersion="4.121.1.0" newVersion="4.112.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
From my experience this trick has worked when redirecting from 10.1 to any newer version, but once we ran in mysterious errors when trying to redirect backward (see this), therefore I advise you to better find the exact reason why this is happening - look in your *.csproj which Oracle.DataAccess exactly is referenced and/or disassemble your binaries to inspect also the references of referenced libraries. (It is possible that rather than your code some 3rd party lib you use wants this exact version of ODP.NET).

Entity Framewok Code First "ADO.NET provider not found" with local SQL Server CE DLL's

I am writing a C# application which uses SQL Server CE 4.0 files, which are accessed through the Entity Framework 6.0 via code-first. (The application needs to be able to use local dll's for the SQL Server CE connection i.e. the application needs to be XCOPY deployable). The application runs fine on my development machine, but on other machines (e.g. VMs with just Win7 and .NET 4.0), I get an ArgumentException:
The ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details.
The inner exception message says:
Unable to find the requested .Net Framework Data Provider. It may not be installed.
I have searched Google and SO and most of the comments indicate ensuring the App.config file is correct. I believe mine is (default connection factory and provider sections), but here are the contents:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
<parameters>
<parameter value="System.Data.SqlServerCe.4.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
</providers>
</entityFramework>
</configuration>
The build folder includes the following files (in addition to the application-specific files, of course):
EntityFramework.dll
EntityFramework.xml
EntityFramework.SqlServer.dll
EntityFramework.SqlServer.xml
EntityFramework.SqlServerCompact.dll
EntityFramework.SqlServerCompact.xml
In each of the amd64 and x86 subfolders are the following files:
sqlceca40.dll
sqlcecompact40.dll
sqlceer40EN.dll
sqlceme40.dll
sqlceqp40.dll
sqlcese40.dll
I am certain the program runs on the development machine because SQL Server CE has been installed, but how do I get it to run using just local SQL Server CE dll's on other machines?
See http://tech.aendeavors.com/2011/06/09/bin-deploy-sqlce-4-0-and-ef-4-1/
It seems the relevant bits you might be missing are:
Make sure System.Data.SqlServerCe is referenced and set to "Copy
local" in properties.
Add the following to app.config:
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add name="Microsoft SQL Server Compact Data Provider 4.0"
invariant="System.Data.SqlServerCe.4.0"
description=".NET Framework Data Provider for Microsoft SQL Server Compact"
type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</DbProviderFactories>
</system.data>
I was facing the same problem today.
After reinstalling EF several times, what solved my problem was referencing EF in my Console project along with the DAL project (the one that actually uses EF).
If you're using a reference that in turn references EF, you gotta add it to this project as well.
Sorry about the late response - actually, there's a really simple solution:
If you investigate the packages\EntityFramework.6.1.3\lib\net45 folder, you'll notice that there's another dll that's already in there - EntityFramework.SqlServer.
Simply add a reference to that, and everything will work.
I had the same issue and nothing worked for me. The only thing that resolved my this issue for me was to uninstall SQL Server Compact from my machine (via add/remove programs) and re-install it.
In my case, "EntityFramework.SqlServerCompact" package was missing. Just wanted to share if in case it can save someone's day!

Firebird Data Access Designer (DDEX) installation

hi i want to use firebird library , and i followed its instruction as below , but i get "The referenced component 'FirebirdSql.Data.Firebird' could not be found." error.
instruction :
Prerequisites
Make sure that you have Visual Studio .NET 2005 Standard or higher edition.
Express editions are not supported.
Registry update
Remember to update the path in FirebirdDDEXProviderPackageLess32.reg or FirebirdDDEXProviderPackageLess64.reg, places where to update it are marked %Path%.
Install the .reg file into the registry.
Machine.config update
Add the following two sections to machine.config (located usually at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config and C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\CONFIG\machine.config on 64-bit system).
<configuration>
...
<configSections>
...
<section name="firebirdsql.data.firebirdclient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
...
</configSections>
...
<system.data>
<DbProviderFactories>
...
<add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".Net Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=%Version%, Culture=%Culture%, PublicKeyToken=%PublicKeyToken%" />
...
</DbProviderFactories>
</system.data>
...
</configuration>
And subst:
%Version% With the version of the provider assembly that you have in the GAC.
%Culture% With the culture of the provider assembly that you have in the GAC.
%PublicKeyToken% With the PublicKeyToken of the provider assembly that you have in the GAC.
Did you add a reference to the assembly in your project? If not, right click in the solution explorer on references and choose add reference. Find the Firebird client assembly and add it.

Categories