I think you are looking for this:
IDbConnection cn = session.Connection;
You now have a normal ADO.Net connection.
Code:
IDbConnection cn = session.Connection;
IDbCommand dbCmd = cn.CreateCommand();
dbCmd.CommandType = CommandType.StoredProcedure;
dbCmd.CommandText = "Insert_Bank_Transaction";
SqlParameter parameter = null;
parameter = new SqlParameter("@data_source_code", SqlDbType.VarChar);
parameter.Value = DataSourceCode;
parameter.Direction = ParameterDirection.Input;
dbCmd.Parameters.Add(parameter);
IDbTransaction tx = cn.BeginTransaction();
dbCmd.Connection = cn;
dbCmd.Transaction = tx;
dbCmd.ExecuteNonQuery();
tx.Commit();
See also:
13.3. Custom SQL for create, update and delete
Being somewhat new to NH I've found that to ease the learning curve and still be productive I'm falling back to the IDbconnection with which I'm familiar. As I become more versant with NH coding I'll start using more of it's features.