HNibernate在多帐套应用中的数据连接

习惯用xml文件配置数据连接?我也是的。在多帐套应用中,我们希望由程序来决定连接数据库。HNibernate当然也可以,同时打开几个连接也是可以的。

以下是修改Config的代码:

Configuration cfg = new Configuration();
cfg.SetProperty(
"hibernate.dialect","NHibernate.Dialect.MsSql2000Dialect");
cfg.SetProperty(
"hibernate.connection.driver_class","NHibernate.Driver.SqlClientDriver");
cfg.SetProperty(
"hibernate.connection.connection_string","Server=localhost;initial catalog=nhibernate;Integrated Security=SSPI");
posted @ 2006-01-26 15:19  生命体验之kevin-Y  阅读(388)  评论(0编辑  收藏  举报