mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-05 05:07:57 +08:00
Add db.Ado.IsValidConnection()
This commit is contained in:
parent
6c752467a8
commit
ed60b3cade
@ -73,6 +73,20 @@ namespace SqlSugar
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Connection
|
#region Connection
|
||||||
|
public virtual bool IsValidConnection()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (OpenAlways())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
public virtual void Open()
|
public virtual void Open()
|
||||||
{
|
{
|
||||||
CheckConnection();
|
CheckConnection();
|
||||||
|
@ -164,6 +164,7 @@ namespace SqlSugar
|
|||||||
void Close();
|
void Close();
|
||||||
void Open();
|
void Open();
|
||||||
SugarConnection OpenAlways();
|
SugarConnection OpenAlways();
|
||||||
|
bool IsValidConnection();
|
||||||
void CheckConnection();
|
void CheckConnection();
|
||||||
|
|
||||||
void BeginTran();
|
void BeginTran();
|
||||||
|
Loading…
Reference in New Issue
Block a user