c# - open - nhibernate session factory configuration

NHibernate: how to set connection timeout (2)

With NHibernate you can provide the connection yourself:


I wouldn't recommend it, because it's easier when sessions are managed by NHibernate.

You can still write your own connection provider, which sets whatever you want on the created connections.

Is there any way to globally setup time you would wait for connecting to a given database, before a connection failure in NHibernate (connection timeout)? In ADO.NET you can do it for a single connection like this:

new SqlConnection().ConnectionTimeout = 10;

I found how to setup the time you would wait for a result set, before a command execution failure here (command timeout). But, apparently, that's not what I need

You can set it on the connection string, "Connection Timeout=x".