mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-31 15:56:25 +08:00
Update db.ado.OpenAlways
This commit is contained in:
parent
48d093a191
commit
4ec5fbd5bb
@ -77,10 +77,15 @@ namespace SqlSugar
|
||||
{
|
||||
CheckConnection();
|
||||
}
|
||||
public virtual void OpenAlways()
|
||||
public SugarConnection OpenAlways()
|
||||
{
|
||||
SugarConnection result = new SugarConnection();
|
||||
result.IsAutoClose = this.Context.CurrentConnectionConfig.IsAutoCloseConnection;
|
||||
result.conn = this.Connection;
|
||||
result.Context = this.Context;
|
||||
this.Context.CurrentConnectionConfig.IsAutoCloseConnection = false;
|
||||
this.Open();
|
||||
return result;
|
||||
}
|
||||
public virtual void Close()
|
||||
{
|
||||
|
22
Src/Asp.Net/SqlSugar/Entities/SugarConnection.cs
Normal file
22
Src/Asp.Net/SqlSugar/Entities/SugarConnection.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlSugar
|
||||
{
|
||||
public class SugarConnection:IDisposable
|
||||
{
|
||||
public IDbConnection conn { get; set; }
|
||||
public bool IsAutoClose { get; set; }
|
||||
public ISqlSugarClient Context { get; set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
conn.Close();
|
||||
this.Context.CurrentConnectionConfig.IsAutoCloseConnection = IsAutoClose;
|
||||
}
|
||||
}
|
||||
}
|
@ -163,7 +163,7 @@ namespace SqlSugar
|
||||
void Dispose();
|
||||
void Close();
|
||||
void Open();
|
||||
void OpenAlways();
|
||||
SugarConnection OpenAlways();
|
||||
void CheckConnection();
|
||||
|
||||
void BeginTran();
|
||||
|
@ -97,6 +97,7 @@
|
||||
<Compile Include="Abstract\SaveableProvider\StorageableDataTable.cs" />
|
||||
<Compile Include="Abstract\SugarProvider\SqlSugarCoreProvider.cs" />
|
||||
<Compile Include="Entities\JoinMapper.cs" />
|
||||
<Compile Include="Entities\SugarConnection.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\SubTemplate.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\SubqueryableN.cs" />
|
||||
<Compile Include="Infrastructure\StaticConfig.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user