저는 NHibernate에서 새롭기 때문에 기능을 어디에 사용해야하는지 혼란 스럽습니다.클래스 라이브러리가있는 웹 폼 nhibernate
나는 다음과 같은 솔루션을
1) MyProject.Web (웹 양식 응용 프로그램)
2) MyProject.Domain (클래스 라이브러리)
- nhibernate.config
- 제품이있다. hbm.xml
맞습니다. 다음 메서드를 IHttpModule에 넣을 수 있습니까? (나는 글로벌 ASP를 사용할 수 없다. 실행중인 CMS에 의해 사용된다.)
어디에서 connectionString이 살아야 하는가?
HttpModule을 웹에서 응용 프로그램을
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" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory name="RBL.Domain">
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="adonet.batch_size">16</property>
<property name="current_session_context_class">web</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<mapping assembly="RBL.Domain"/>
</session-factory>
</hibernate-configuration>