【问题标题】:Fluent nHibernate error CreatingSessionFactory with OracleFluent nHibernate 错误 CreatingSessionFactory with Oracle
【发布时间】:2010-07-20 08:55:48
【问题描述】:

当我尝试 BuildSessionFactory() 时,我收到一条错误消息,提示它找不到以下组件:

无法从 NHibernate.Driver.OracleDataClientDriver 创建驱动程序,NHibernate,版本=2.1.2.4000

我在我的 bin 文件夹和本地引用了 Oracle.DataAccess 4.11 版,我正在使用:

Oracle 10 和 Visual Studio 2010 .NET 4

并使用以下方法调用:

public static ISessionFactory CreateSessionFactory()
    {
        FluentConfiguration idk = Fluently
            .Configure()
            .Database(OracleDataClientConfiguration
                .Oracle9
                .UseReflectionOptimizer()
                .MaxFetchDepth(3)
                .AdoNetBatchSize(500)
                .ConnectionString(cs => cs
                .Server("Paul-PC")
                .Port(1521)
                .Instance("xe")
                .Username("xxxx")
                .Password("xxxx")
                .Pooling(true)
                .StatementCacheSize(100)
                .OtherOptions(
                "Min Pool Size=10;Incr Pool Size=5;Decr Pool Size=2;")
            )
            // It does this automatically.. but I like to be explicit ;)
            .ProxyFactoryFactory("NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle")
            .ShowSql()
            )
            .Mappings(m => m.FluentMappings.Add(typeof(PortalUserMap)));

        idk.ExposeConfiguration(BuildSchema);

        return idk.BuildSessionFactory();
    }

PortalUserMap 类如下:

using System;

使用 System.Collections.Generic; 使用 System.Linq; 使用 System.Text; 使用 FluentNHibernate.Mapping; 使用 Mobisoft.Portal.Security.Entities;

命名空间 Mobisoft.Portal.Security.Mappings { 公共类 PortalUserMap : ClassMap { 公共 PortalUserMap() { 表("PORTALUSER");

        Id(x => x.Id, "ID").GeneratedBy.Identity();
        Map(x => x.Name, "NAME");
    }

}

请大家帮帮我,我这两天一直在网上找答案。

保罗。

【问题讨论】:

    标签: fluent-nhibernate


    【解决方案1】:

    Fluent NHibernate 1.1 参考 NHibernate 2.1.X,您需要在项目中参考 fluent NHibernate 1.2,然后才能将它与 NHibernate 3.0.4 或更高版本一起使用,我猜这就是您正在使用的。 你可以在这里下载 http://fluentnhibernate.org/dls/v1.x/fluentnhibernate-NH3.0-binary-1.2.0.694.zip

    【讨论】:

      【解决方案2】:

      更新项目中对 Oracle.DataAccess.dll 的引用,将 CopyLocal 设置为 True。

      【讨论】:

        猜你喜欢
        • 2011-07-29
        • 1970-01-01
        • 1970-01-01
        • 2023-03-12
        • 1970-01-01
        • 2013-10-04
        • 1970-01-01
        • 2014-12-15
        • 1970-01-01
        相关资源
        最近更新 更多