【发布时间】: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");
}
}
请大家帮帮我,我这两天一直在网上找答案。
保罗。
【问题讨论】: