From d6823b6a21509429471c54c916da0cafd5230fbb Mon Sep 17 00:00:00 2001 From: 2881099 <2881099@qq.com> Date: Sun, 27 Aug 2023 20:52:04 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BC=98=E5=8C=96=20Sqlite=20=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E4=BD=BF=E7=94=A8=20AdoPool=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Examples/base_entity/Program.cs | 2 ++ FreeSql.DbContext/FreeSql.DbContext.xml | 18 ------------------ FreeSql/FreeSqlBuilder.cs | 8 ++++++-- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/Examples/base_entity/Program.cs b/Examples/base_entity/Program.cs index 329b79a7..7837fc37 100644 --- a/Examples/base_entity/Program.cs +++ b/Examples/base_entity/Program.cs @@ -600,6 +600,8 @@ namespace base_entity BaseEntity.Initialization(fsql, () => _asyncUow.Value); #endregion + var testr1 = fsql.Ado.ExecuteConnectTest(); + var dict = new List>(); Dictionary d = new Dictionary(); d.Add("id", 2); diff --git a/FreeSql.DbContext/FreeSql.DbContext.xml b/FreeSql.DbContext/FreeSql.DbContext.xml index 26522f10..594fbad3 100644 --- a/FreeSql.DbContext/FreeSql.DbContext.xml +++ b/FreeSql.DbContext/FreeSql.DbContext.xml @@ -733,15 +733,6 @@ - - - 根据Assembly扫描所有继承IEntityTypeConfiguration<T>的配置类 - - - - - - 创建普通数据上下文档对象 @@ -800,14 +791,5 @@ - - - 批量注入 Repository,可以参考代码自行调整 - - - - - - diff --git a/FreeSql/FreeSqlBuilder.cs b/FreeSql/FreeSqlBuilder.cs index 3a425ec6..901fc8f1 100644 --- a/FreeSql/FreeSqlBuilder.cs +++ b/FreeSql/FreeSqlBuilder.cs @@ -24,7 +24,7 @@ namespace FreeSql bool _isLazyLoading = false; bool _isExitAutoDisposePool = true; bool _isQuoteSqlName = true; - bool _isAdoConnectionPool = false; + bool? _isAdoConnectionPool = null; MappingPriorityType[] _mappingPriorityTypes; NameConvertType _nameConvertType = NameConvertType.None; Action _aopCommandExecuting = null; @@ -370,9 +370,13 @@ namespace FreeSql default: throw new Exception(CoreStrings.NotSpecified_UseConnectionString_UseConnectionFactory); } } + var isAdoPool = false; + if (_isAdoConnectionPool != null) isAdoPool = _isAdoConnectionPool.Value; + else if (_dataType == DataType.Sqlite) isAdoPool = true; //sqlite 默认使用 Ado Pool + else isAdoPool = false; ret = Activator.CreateInstance(type, new object[] { - _isAdoConnectionPool ? $"AdoConnectionPool,{_masterConnectionString}" : _masterConnectionString, + isAdoPool ? $"AdoConnectionPool,{_masterConnectionString}" : _masterConnectionString, _slaveConnectionString, _connectionFactory }) as IFreeSql;