The place where <=== ERROR is shown causes an *Object reference not set to an instance of an object* error.
The file hibernate.cfg.xml has been placed in the output directory, so it can see it.
I have included a copy below, just in case it's layout is the cause.
Can anyone please tell me why
Thanks
BOb
Code:
public sealed class Global
{
private static Configuration nhConfig;
private static ISessionFactory nhFactory;
public static ISession NHSession
{
get
{
if (nhFactory == null)
{
nhConfig = new Configuration();
nhConfig.Configure(); <===== ERROR
nhConfig.AddAssembly("DAL");
nhFactory = nhConfig.BuildSessionFactory();
}
return nhFactory.OpenSession();
}
}
private Global ()
{
}
}
hibernate.cfg.xml
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<log4net>
<appender name="rollingFile" type="log4net.Appender.RollingFileAppender, log4net" >
<param name="File" value="log.txt" />
<param name="AppendToFile" value="true" />
<param name="RollingStyle" value="Date" />
<param name="DatePattern" value="yyyy.MM.dd" />
<param name="StaticLogFileName" value="true" />
<layout type="log4net.Layout.PatternLayout, log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" />
</layout>
</appender>
<root>
<priority value="DEBUG" />
<appender-ref ref="rollingFile" />
</root>
</log4net>
<nhibernate>
<add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
<add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2000Dialect" />
<add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
<add key="hibernate.connection.connection_string" value="Server=localhost;Database=LLBProTest;User=sa;Pwd=sqladmin;" />
<add key="hibernate.show_sql" value="true" />
</nhibernate>
</configuration>
[/code]