Hello,
I'm trying to configure ASP.NET MVC 2 RC and Spring .NET 1.3 to use FluentNHibernate.
I've managed to get FluentNHibernate running inside console application.
At moment ASP.NET MVC 2 RC and Spring .NET are working fine for me, but I'm having trouble configuring FluentHibernate.
Before asking this question I have Googled a lot, I have also looked through relevant questions on StackOverflow.
I know that there is this (http://www.bennymichielsen.be/post/2009/01/04/Using-Fluent-NHibernate-in-SpringNet.aspx) blog post and Spring .NET documentation ORM chapter (http://www.springframework.net/doc-latest/reference/html/orm.html)
Just like Benny's blog suggests I have created "FluentNHibernateLocalSessionFactoryObject" the contents of this class is same as in blog post.
My Spring configuration file looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
xmlns:db="http://www.springframework.net/database"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd">
<object id="MySessionFactory" type="Project.Core.NHinbernate.FluentNHibernateLocalSessionFactoryObject, Spring.Data.NHibernate20">
<property name="DbProvider" ref="DbProvider"/>
<property name="FluentNHibernateMappingAssemblies">
<list>
<value>Project.Core.NHibernate</value>
</list>
</property>
<property name="HibernateProperties">
<dictionary>
<entry key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
<entry key="hibernate.dialect" value="NHibernate.Dialect.MsSql2008Dialect"/>
<entry key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver"/>
</dictionary>
</property>
</object>
<object id="HomeController" singleton="false" type="Project.UI.Controllers.HomeController">
<property name="MySessionFactory" value="MySessionFactory" />
</object>
</objects>
I think this configuration has a lot of things missing (connection string, correct SQL Server 2008 dialect and DB provider).
My goal is to simply inject SessionFactory into HomeController.
I would be very greatful if you could point out what should be changed in my configuration file.
Thank You very much!