Like so many others, I am trying to get NHibernate up and running. I have consulted the documentation, blogs, etc. and have come here as a last ditch effort to get this running. Thank you for any insight and help ahead of time....
Here is my hibernate.cfg.xml file contents :
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory xmlns="urn:nhibernate-configuration-2.2">
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<property name="hibernate.dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.connection_string">
DataSource=.\SQLEXPRESS;InitialCatalog=haloData.mdf;User Instance=True;Integrated Security=True
</property>
</session-factory>
</hibernate-configuration>
</configuration>
Here is my main class:
Code:
using System;
using System.Collections.Generic;
using NHibernate;
using NHibernate.Cfg;
namespace MyTest
{
class Program
{
static void Main(string[] args)
{
ISessionFactory _sessionFactory;
ISession _session;
ITransaction _transaction;
Configuration configuration = new Configuration();
//configuration.Configure();
_sessionFactory = configuration.BuildSessionFactory();
_session = _sessionFactory.OpenSession();
_transaction = _session.BeginTransaction();
// _transaction.Rollback();
_transaction.Dispose();
_session.Close();
_session.Dispose();
}
}
}
The resultant error:
Code:
The ProxyFactoryFactory was not configured.
Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>