Hi all, I am using NHibernate to as the Data Access layer for my ASP.NET MVC application. I am also using Structure Map as an IoC container. I have configured Structre map to create a session factory as a singleton and create sessions on a per request basis (InstanceScope.Hybrid). I am able to do basic CRUD operations just fine.
Now, I have a background process running every 30 seconds, which uses a few repositories(which in turn use sessions). And this background process is unable to pick up the new data for some reason. Maybe I am missing a simple thing. I tried googling but was unable to find anything useful. It would really help me if someone pointed me in the right direction.
EDIT:
I am not sure if I have the second level cache enabled, I am a newbie with NHibernate, My hibernate configuration file is pasted below.
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.connection_string">Data Source=.\SQLEXPRESS;Initial Catalog=Map.db;Integrated Security=True</property>
<property name="show_sql">true</property>
<mapping assembly="Infrastructure"/>
</session-factory>
</hibernate-configuration>
The main thing I want to know is, if there is a design/design pattern which is already used in typical web applications using NHibernate. And would using Stateless sessions solve the problem, if my database settings are updated from a different app?