N Hybernate初始目录 [英] N Hybernate Initial Catalog

查看:167
本文介绍了N Hybernate初始目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
  </configSections>
  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
      <property name="query.substitutions">hqlFunction=SQLFUNC</property>
      <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
      <property name="connection.connection_string">Data Source=(Local)\SQL2008;Initial Catalog=NHibernateBasics;Integrated Security=True</property>
      <property name="show_sql">true</property>
      <mapping assembly="NHibernateBasics" />
    </session-factory>
  </hibernate-configuration>
</configuration>



这是NHybernate的基本代码.在此代码中,初始目录(数据库名称)设置为静态.



This is the basic code for NHybernate. in this code the Initial Catalog (Database name)is set static. is it possible to set dynamically?

推荐答案

看看下面的NHibernate动态连接字符串更改链接.

动态NHibernate连接字符串
Have a look at below link for NHibernate dynamic connection string change.

Dynamic NHibernate Connection String


这篇关于N Hybernate初始目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆