NHibernate的问题
小弟我刚接触NHibernate遇到一问题,实在没则,所以请教各位达人赐教.
private NHibernate.Cfg.Configuration cfg;
/// <summary>
/// 构建一个Session工厂。
/// </summary>
private void BuildSessionFactory()
{
cfg = new NHibernate.Cfg.Configuration();
string connectString = AppConfigSingleton.GetAppConfigSingleton().GetConfigValue( "ConnectionString ");
//加载数据实体
cfg.SetProperty( "hibernate.connection.connection_string ", connectString);
string assembly = AppConfigSingleton.GetAppConfigSingleton().GetConfigValue( "LoadDataLayerAssembly ");
string[] assemblys = assembly.Split(new char[] { ', ' });
for (int i = 0; i < assemblys.Length; i++)
{
cfg.AddAssembly(assemblys[i]);
}
sessions = cfg.BuildSessionFactory();
编译程序没有问题,但是在运行时老是抛出这个错误:
Could not load file or assembly 'log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905 ' or one of its dependencies. 系统找不到指定的文件。
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:
System.IO.FileNotFoundException: Could not load file or assembly 'log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905 ' or one of its dependencies. 系统找不到指定的文件。
Source Error:
Line 93: private void BuildSessionFactory()
Line 94: {
Line 95: cfg = new NHibernate.Cfg.Configuration();//错误地方在这里
Line 96: string connectString = AppConfigSingleton.GetAppConfigSingleton().GetConfigValue( "ConnectionString ");
Line 97: try
这是为什么我的web-config有log4net节点啊!!!
------解决方案--------------------看一下项目中的引用,