I started learning NHibernate since 2 weeks and i've read the book NHibernate 3 beginners guide. Unfortunately the book is written on the 3.1 version of it and since 3.2 some things has changed. No castle support anymore, ..
I had hoped to find some example-application or tutorial in 3.2, but can't find something like that anywhere. The most things are actually blog items about Nhibernates 3.2 replacement for FNH.
Since this afternoon the sessionfactory and stuff works without giving any errors (using session per request approach with a actionfilter) but i can't get my database generated. I'm mapping the classic way with .hbm.xml files for each entity. After reading a lot of websites and blogs i finally made this configuration:
protected void Application_Start(object sender, EventArgs e)
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
var nhConfig = new Configuration().Configure();
nhConfig.AddAssembly(typeof(Book).Assembly);
BuildSchema(nhConfig);
SessionFactory = nhConfig.BuildSessionFactory();
}
private static void BuildSchema(Configuration nhConfig)
{
new SchemaExport(nhConfig).Execute(false, true, false);
}
My relevant web.config code looks like this:
<connectionStrings>
<add name="db" connectionString="Server=.\SQLExpress; Database=NHbTest; Trusted_Connection=SSPI"/>
</connectionStrings>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect,NHibernate</property>
<property name="connection.connection_string_name">db</property>
<property name="adonet.batch_size">100</property>
<property name="current_session_context_class">web</property>
</session-factory>
</hibernate-configuration>
Someone sees what i'm doing wrong? Thx in advance.