NHibernate 连接 Access数据库配置

中间层代码:
private static readonly NHibernate.Cfg.Configuration configuration; 
configuration 
= new Configuration().Configure();
string connection_string = configuration.GetProperty("hibernate.connection.connection_string");
connection_string 
= connection_string.Replace("|ServerDirectory|", HttpContext.Current.Request.MapPath("~"));
configuration.SetProperty(
"hibernate.connection.connection_string", connection_string);
configuration.SetProperty(
"connection.connection_string", connection_string);
sessionFactory 
= configuration.BuildSessionFactory();

web.config 中配置如下
<property name="connection.connection_string">Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|ServerDirectory|\\App_Data\\Sample.mdb</property>
posted @ 2008-05-28 01:52  江湖超  阅读(457)  评论(0编辑  收藏  举报