mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-29 19:56:43 +08:00
33 lines
861 B
C#
33 lines
861 B
C#
![]() |
using OrmTest.Models;
|
|||
|
using SqlSugar;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace OrmTest.UnitTest
|
|||
|
{
|
|||
|
public class AutoClose : UnitTestBase
|
|||
|
{
|
|||
|
public AutoClose(int eachCount)
|
|||
|
{
|
|||
|
this.Count = eachCount;
|
|||
|
}
|
|||
|
public void Init()
|
|||
|
{
|
|||
|
//IsAutoCloseConnection
|
|||
|
for (int i = 0; i < this.Count; i++)
|
|||
|
{
|
|||
|
var db = GetInstance();
|
|||
|
var x = db.Queryable<Student>().ToList();
|
|||
|
}
|
|||
|
}
|
|||
|
public SqlSugarClient GetInstance()
|
|||
|
{
|
|||
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.Sqlite, IsAutoCloseConnection = true });
|
|||
|
return db;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|