0

I've created a basic console app for playing around with Simple.Data against an Oracle server. However, when trying to open a connection I get the following error: "No ADO Provider found."

I installed the following NuGet packages:

  • Simple.Data.Core (version 0.17.0.1)
  • Simple.Data.Ado (version 0.17.0.1)
  • Simple.Data.Oracle (version 0.17.0.0)
  • Oracle Data Provier for .NET (ODP.NET) x86 (version 112.3.0) (also tried the x64 but to no avail)

This is my code:

class Program
{
    static void Main(string[] args)
    {
        string connectionString = ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
        var db = Database.OpenConnection(connectionString); // this is where I get the error
        var list = db.MyTable.All().ToList();
    }
}

app.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings>
    <add name="MyConnectionString" connectionString="user id=SomeUser;password=SomePwd;data source=MyTNS" />
  </connectionStrings>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.112.3.0" newVersion="4.112.3.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

And MyTNS does exist.

What am I missing?

4

1 に答える 1

2

providerNameあなたは属性を逃しました。

<connectionStrings>
    <add name="MyConnectionString" 
         connectionString="user id=SomeUser;password=SomePwd;data source=MyTNS" 
         providerName="Oracle.DataAccess.Client"
         />
  </connectionStrings>
于 2012-08-23T14:57:27.853 に答える