- 优化 IAdo.ConnectionString 使用 UseConnectionFactory 时值为 NULL 的问题;

This commit is contained in:
2881099
2023-01-16 19:16:56 +08:00
parent 32e45dd925
commit 33f11a2066
33 changed files with 131 additions and 32 deletions

View File

@ -19,7 +19,9 @@ namespace FreeSql.ClickHouse
base._util = util;
if (connectionFactory != null)
{
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.ClickHouse, connectionFactory);
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.ClickHouse, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}
if (!string.IsNullOrEmpty(masterConnectionString))

View File

@ -18,6 +18,7 @@ namespace FreeSql.Custom
if (connectionFactory != null)
{
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.SqlServer, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
_CreateCommandConnection = pool.TestConnection;
_CreateParameterCommand = CreateCommand();

View File

@ -20,6 +20,7 @@ namespace FreeSql.Custom.MySql
if (connectionFactory != null)
{
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.SqlServer, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}

View File

@ -21,6 +21,7 @@ namespace FreeSql.Custom.Oracle
if (connectionFactory != null)
{
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.SqlServer, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
using (var conn = pool.Get())
UserId = CustomOracleAdo.GetUserId(conn.Value.ConnectionString);

View File

@ -21,6 +21,7 @@ namespace FreeSql.Custom.PostgreSQL
if (connectionFactory != null)
{
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.SqlServer, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}

View File

@ -21,6 +21,7 @@ namespace FreeSql.Custom.SqlServer
if (connectionFactory != null)
{
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.SqlServer, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}

View File

@ -17,7 +17,9 @@ namespace FreeSql.Dameng
base._util = util;
if (connectionFactory != null)
{
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.Dameng, connectionFactory);
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.Dameng, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}
if (!string.IsNullOrEmpty(masterConnectionString))

View File

@ -20,6 +20,7 @@ namespace FreeSql.Firebird
if (connectionFactory != null)
{
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.Firebird, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
_CreateCommandConnection = pool.TestConnection;
return;

View File

@ -20,6 +20,7 @@ namespace FreeSql.GBase
if (connectionFactory != null)
{
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.GBase, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
_CreateCommandConnection = pool.TestConnection;
return;

View File

@ -19,7 +19,9 @@ namespace FreeSql.KingbaseES
base._util = util;
if (connectionFactory != null)
{
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.KingbaseES, connectionFactory);
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.KingbaseES, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}
if (!string.IsNullOrEmpty(masterConnectionString))

View File

@ -19,7 +19,9 @@ namespace FreeSql.MsAccess
base._util = util;
if (connectionFactory != null)
{
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.MsAccess, connectionFactory);
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.MsAccess, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}
if (!string.IsNullOrEmpty(masterConnectionString))

View File

@ -23,7 +23,9 @@ namespace FreeSql.MySql
base._util = util;
if (connectionFactory != null)
{
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.MySql, connectionFactory);
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.MySql, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}
if (!string.IsNullOrEmpty(masterConnectionString))

View File

@ -18,7 +18,9 @@ namespace FreeSql.Odbc.Dameng
base._util = util;
if (connectionFactory != null)
{
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.OdbcDameng, connectionFactory);
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.OdbcDameng, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}
if (!string.IsNullOrEmpty(masterConnectionString))

View File

@ -18,7 +18,9 @@ namespace FreeSql.Odbc.Default
base._util = util;
if (connectionFactory != null)
{
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.Odbc, connectionFactory);
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.Odbc, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}
if (!string.IsNullOrEmpty(masterConnectionString))

View File

@ -19,7 +19,9 @@ namespace FreeSql.Odbc.KingbaseES
base._util = util;
if (connectionFactory != null)
{
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.OdbcKingbaseES, connectionFactory);
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.OdbcKingbaseES, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}
if (!string.IsNullOrEmpty(masterConnectionString))

View File

@ -19,7 +19,9 @@ namespace FreeSql.Odbc.MySql
base._util = util;
if (connectionFactory != null)
{
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.OdbcMySql, connectionFactory);
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.OdbcMySql, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}
if (!string.IsNullOrEmpty(masterConnectionString))

View File

@ -18,7 +18,9 @@ namespace FreeSql.Odbc.Oracle
base._util = util;
if (connectionFactory != null)
{
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.OdbcOracle, connectionFactory);
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.OdbcOracle, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}
if (!string.IsNullOrEmpty(masterConnectionString))

View File

@ -19,7 +19,9 @@ namespace FreeSql.Odbc.PostgreSQL
base._util = util;
if (connectionFactory != null)
{
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.OdbcPostgreSQL, connectionFactory);
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.OdbcPostgreSQL, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}
if (!string.IsNullOrEmpty(masterConnectionString))

View File

@ -19,7 +19,9 @@ namespace FreeSql.Odbc.SqlServer
base._util = util;
if (connectionFactory != null)
{
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.OdbcSqlServer, connectionFactory);
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.OdbcSqlServer, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}
if (!string.IsNullOrEmpty(masterConnectionString))

View File

@ -16,7 +16,9 @@ namespace FreeSql.Oracle
base._util = util;
if (connectionFactory != null)
{
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.Oracle, connectionFactory);
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.Oracle, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}
if (!string.IsNullOrEmpty(masterConnectionString))

View File

@ -21,7 +21,9 @@ namespace FreeSql.PostgreSQL
base._util = util;
if (connectionFactory != null)
{
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.PostgreSQL, connectionFactory);
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.PostgreSQL, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}
if (!string.IsNullOrEmpty(masterConnectionString))

View File

@ -19,7 +19,9 @@ namespace FreeSql.ShenTong
base._util = util;
if (connectionFactory != null)
{
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.ShenTong, connectionFactory);
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.ShenTong, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
return;
}
if (!string.IsNullOrEmpty(masterConnectionString))

View File

@ -24,6 +24,7 @@ namespace FreeSql.SqlServer
if (connectionFactory != null)
{
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.SqlServer, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
_CreateCommandConnection = pool.TestConnection;
return;

View File

@ -24,6 +24,7 @@ namespace FreeSql.Sqlite
if (connectionFactory != null)
{
var pool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.Sqlite, connectionFactory);
ConnectionString = pool.TestConnection?.ConnectionString;
MasterPool = pool;
_CreateCommandConnection = pool.TestConnection;
return;