mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-03-04 13:10:57 +08:00
- 补充 ObjectPool Async CancellationToken 参数;#2177
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
using FreeSql.Internal.ObjectPool;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FreeSql.Firebird
|
||||
@@ -124,7 +124,7 @@ namespace FreeSql.Firebird
|
||||
|
||||
#if net40
|
||||
#else
|
||||
async public Task OnGetAsync(Object<DbConnection> obj)
|
||||
async public Task OnGetAsync(Object<DbConnection> obj, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
if (_pool.IsAvailable)
|
||||
@@ -133,7 +133,7 @@ namespace FreeSql.Firebird
|
||||
throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name));
|
||||
|
||||
if (obj.Value.State != ConnectionState.Open)
|
||||
await obj.Value.OpenAsync();
|
||||
await obj.Value.OpenAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -183,23 +183,5 @@ namespace FreeSql.Firebird
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#if net40
|
||||
#else
|
||||
async public static Task<bool> PingAsync(this DbConnection that, bool isThrow = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
await PingCommand(that).ExecuteNonQueryAsync();
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (that.State != ConnectionState.Closed) try { that.Close(); } catch { }
|
||||
if (isThrow) throw;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user