Click here to Skip to main content
15,887,436 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<?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>


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

1 solution

Have a look at below link for NHibernate dynamic connection string change.

Dynamic NHibernate Connection String
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900