Skip to main content
added 207 characters in body
Source Link
Sly
  • 15.3k
  • 13
  • 63
  • 90

You can use connection.connection_string_name element in the NHibernate configuration. Have a look herehere. Then NHibernate will get connection string by name from web.config file

You need to use the connection.connection_string_name attribute in the configuration:

<connectionStrings>
    <add name="default" connectionString="server=(local);etc." />
</connectionStrings>

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
        <property name="connection.connection_string_name">default</property>
    </session-factory>
</hibernate-configuration>

With fluent configuration you can do the following

ConnectionString(c=>c.FromConnectionStringWithKey("YourConnStrName"))

With NHibernate configuration API you can do the following:

var cfg = new Configuration();
cfg.DataBaseIntegration(db =>
{
    db.ConnectionStringName = "default";             
});

You can use connection.connection_string_name element in the NHibernate configuration. Have a look here. Then NHibernate will get connection string by name from web.config file

You need to use the connection.connection_string_name attribute in the configuration:

<connectionStrings>
    <add name="default" connectionString="server=(local);etc." />
</connectionStrings>

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
        <property name="connection.connection_string_name">default</property>
    </session-factory>
</hibernate-configuration>

With fluent configuration you can do the following

ConnectionString(c=>c.FromConnectionStringWithKey("YourConnStrName"))

You can use connection.connection_string_name element in the NHibernate configuration. Have a look here. Then NHibernate will get connection string by name from web.config file

You need to use the connection.connection_string_name attribute in the configuration:

<connectionStrings>
    <add name="default" connectionString="server=(local);etc." />
</connectionStrings>

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
        <property name="connection.connection_string_name">default</property>
    </session-factory>
</hibernate-configuration>

With fluent configuration you can do the following

ConnectionString(c=>c.FromConnectionStringWithKey("YourConnStrName"))

With NHibernate configuration API you can do the following:

var cfg = new Configuration();
cfg.DataBaseIntegration(db =>
{
    db.ConnectionStringName = "default";             
});
added 348 characters in body
Source Link
Chris S
  • 65.6k
  • 53
  • 225
  • 240

You can use connection.connection_string_name element in the NHibernate configuration. Have a look here. Then NHibernate will get connection string by name from web.config file

You need to use the hibernate.connection.connection_string_name attribute in the configuration:

<connectionStrings>
    <add name="default" connectionString="server=(local);etc." />
</connectionStrings>

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
        <property name="connection.connection_string_name">default</property>
    </session-factory>
</hibernate-configuration>

With fluent configuration you can do the following

ConnectionString(c=>c.FromConnectionStringWithKey("YourConnStrName"))

You can use connection.connection_string_name element in the NHibernate configuration. Have a look here. Then NHibernate will get connection string by name from web.config file

You need to use the hibernate.connection.connection_string_name attribute in the configuration

With fluent configuration you can do the following

ConnectionString(c=>c.FromConnectionStringWithKey("YourConnStrName"))

You can use connection.connection_string_name element in the NHibernate configuration. Have a look here. Then NHibernate will get connection string by name from web.config file

You need to use the connection.connection_string_name attribute in the configuration:

<connectionStrings>
    <add name="default" connectionString="server=(local);etc." />
</connectionStrings>

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
        <property name="connection.connection_string_name">default</property>
    </session-factory>
</hibernate-configuration>

With fluent configuration you can do the following

ConnectionString(c=>c.FromConnectionStringWithKey("YourConnStrName"))
bolded the answer!
Source Link
Chris S
  • 65.6k
  • 53
  • 225
  • 240

You can use connection.connection_string_name element in the NHibernate configuration. Have a look here. Then NHibernate will get connection string by name from web.config file You need to use hibernate.connection.connection_string_name attribute in configuration

You need to use the hibernate.connection.connection_string_name attribute in the configuration

With fluent configuration you can do the following

ConnectionString(c=>c.FromConnectionStringWithKey("YourConnStrName"))

You can use connection.connection_string_name element in the NHibernate configuration. Have a look here. Then NHibernate will get connection string by name from web.config file You need to use hibernate.connection.connection_string_name attribute in configuration

With fluent configuration you can do the following

ConnectionString(c=>c.FromConnectionStringWithKey("YourConnStrName"))

You can use connection.connection_string_name element in the NHibernate configuration. Have a look here. Then NHibernate will get connection string by name from web.config file

You need to use the hibernate.connection.connection_string_name attribute in the configuration

With fluent configuration you can do the following

ConnectionString(c=>c.FromConnectionStringWithKey("YourConnStrName"))
improved answer
Source Link
Sly
  • 15.3k
  • 13
  • 63
  • 90
Loading
added 19 characters in body
Source Link
Sly
  • 15.3k
  • 13
  • 63
  • 90
Loading
added 88 characters in body
Source Link
Sly
  • 15.3k
  • 13
  • 63
  • 90
Loading
Source Link
Sly
  • 15.3k
  • 13
  • 63
  • 90
Loading