- 支持 Sqlite :memory: 模式; #191

This commit is contained in:
28810
2020-01-21 11:36:01 +08:00
parent 15d5a59221
commit fc4071b730
5 changed files with 48 additions and 5 deletions

View File

@ -3,6 +3,7 @@ using FreeSql.Internal.Model;
using SafeObjectPool;
using System;
using System.Collections;
using System.Data;
using System.Data.Common;
using System.Data.SQLite;
using System.Text;
@ -18,9 +19,9 @@ namespace FreeSql.Sqlite
base._util = util;
if (connectionFactory != null)
{
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.Sqlite, connectionFactory);
_CreateCommandConnection = MasterPool.Get().Value;
_CreateCommandConnection.Close();
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.Sqlite, connectionFactory);
MasterPool = pool;
_CreateCommandConnection = pool.TestConnection;
return;
}
if (!string.IsNullOrEmpty(masterConnectionString))

View File

@ -106,6 +106,12 @@ namespace FreeSql.Sqlite
_connectionString = string.Concat(att[0], idx == -1 ? "" : att[1].Substring(idx));
}
if (_connectionString.ToLower().Contains(":memory:"))
{
//内存模式
PoolSize = 1;
}
#if ns20
minPoolSize = 1;
#endif