nhibernate webforms with class library
- by frosty
very new to nhibernate. I'm a little confused on where features should live.
I have the following solution
1) MyProject.Web ( web forms application)
2) MyProject.Domain( class lib)
- nhibernate.config
- product.hbm.xml
So is it correct I should put the following method in a IHttpModule? ( i can't use a global asax as it's use by the CMS i'm running )
Where should the connectionString live?
HTTPModule in web forms application
private static ISessionFactory CreateSessionFactory()
{
var cfg = new Configuration().Configure(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "nhibernate.config"));
cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionStringName, System.Environment.MachineName);
NHibernateProfiler.Initialize();
return cfg.BuildSessionFactory();
}
nhibernate.config
<?xml version="1.0" encoding="utf-8" ?>
NHibernate.Dialect.MsSql2005Dialect
NHibernate.Connection.DriverConnectionProvider
NHibernate.Driver.SqlClientDriver
16
web
NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle
enter code here