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