流利的NHibernate 3和Oracle.DataAccess [英] Fluent NHibernate 3 and Oracle.DataAccess

查看:72
本文介绍了流利的NHibernate 3和Oracle.DataAccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题:

我正在尝试将Oracle.DataAccess.Client提供程序与NHibernate(Fluent)一起使用,并且我对其进行了如下配置:

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"))).

我有这个错误:

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

我已经添加了对Oracle.Dataaccess dll(ODAC)的引用,其副本为local = true,但是错误仍然存​​在...

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

有什么建议吗?

推荐答案

以下是有效的代码段:

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");
        });
}

不指定提供程序,它将自动启动Oracle DataAccess.

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

修改: 它不会自动拾取它,我只是将其放在我的连接字符串上:

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"/>

这篇关于流利的NHibernate 3和Oracle.DataAccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆