forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDebugConnectionProvider.cs
40 lines (36 loc) · 1.09 KB
/
DebugConnectionProvider.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by AsyncGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections.Concurrent;
using System.Data;
using System.Data.Common;
using System.Linq;
using NHibernate.Connection;
namespace NHibernate.Test
{
using System.Threading.Tasks;
using System.Threading;
public partial class DebugConnectionProvider : DriverConnectionProvider
{
public override async Task<DbConnection> GetConnectionAsync(CancellationToken cancellationToken)
{
try
{
var connection = await (base.GetConnectionAsync(cancellationToken));
connections.TryAdd(connection, 0);
return connection;
}
catch (OperationCanceledException) { throw; }
catch (Exception e)
{
throw new HibernateException("Could not open connection to: " + ConnectionString, e);
}
}
}
}