2

my question:

I am trying to use Oracle.DataAccess.Client Provider with NHibernate (Fluent), and I configured it as follows:

Fluently.Configure().Database(OracleClientConfiguration.Oracle10.Provider("Oracle.DataAccess.Client").ConnectionString(c => c.FromConnectionStringWithKey("ORACLE1"))).

and I have this error:

"Could not load type Oracle.DataAccess.Client. Possible cause: no assembly name specified.":"

I already add Reference to Oracle.Dataaccess dll (ODAC) with copy local = true, but error persist...

Any suggestions?

1 Answer 1

4

Here's a working code snippet:

public static void InitializeNHibernate()
{
    var configurer = (OracleClientConfiguration.Oracle10.ShowSql().ConnectionString(c =>
                 c.FromConnectionStringWithKey("development"))
                 .DefaultSchema("myschema")
                 .UseReflectionOptimizer()
                 .Cache(c =>
                         c.ProviderClass<SysCacheProvider>()
                         .UseQueryCache()));

    var cfg = Fluently.Configure()
        .Database(configurer)
        .Mappings(m =>
                      {
                          m.FluentMappings
                              .AddFromAssemblyOf<Employee>()
                              .Conventions.Add<OracleDateTimeTypeConvention>();

                          m.HbmMappings
                              .AddFromAssemblyOf<Employee>();
                      })
        .ExposeConfiguration(configuration =>
        {
            configuration.SetProperty(Environment.Hbm2ddlKeyWords, "auto-quote");
            configuration.SetProperty(Environment.GenerateStatistics, "true");
            configuration.SetProperty(Environment.CurrentSessionContextClass, "web");
            configuration.SetProperty(Environment.CommandTimeout, "60");
        });
}

Without specifying a provider, it automatically picks Oracle DataAccess up.

Edit: It does not pick it up automatically, I just have it on my connection string:

<add name="development" connectionString="Data Source=XXX;User ID=yyy;Password=zzz;" providerName="Oracle.DataAccess.Client"/>
Sign up to request clarification or add additional context in comments.

7 Comments

Are You sure it uses Oracle DataAccess?? isnt it using System.Data.OracleClient?
I'm sure.If I remove the reference, It'll ask specifically for it. Fyi, you don't need System.Data.OracleClient as a reference.
i tryied too providerName="Oracle.DataAccess.Client" in connection string, but it seems be ignored.
How did you put the Oracle.DataAccess.Client on your box? XCOPY or install, since ADO.NET providers must be referenced in config files (see machine.config for example of SQL Server provider).
Installed it. It didn't show up on my <add reference> options, so I added it manually.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.