mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 增加 IAdo.ConnectionString 属性返回 UseConnectionString 传入的值;
This commit is contained in:
parent
e245543c5a
commit
a6eae955ed
@ -2128,6 +2128,16 @@
|
|||||||
数据库类型
|
数据库类型
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:FreeSql.IAdo.ConnectionString">
|
||||||
|
<summary>
|
||||||
|
UseConnectionString 时候的值
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:FreeSql.IAdo.SlaveConnectionStrings">
|
||||||
|
<summary>
|
||||||
|
UseSalve 时候的值
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="M:FreeSql.IAdo.Transaction(System.Action)">
|
<member name="M:FreeSql.IAdo.Transaction(System.Action)">
|
||||||
<summary>
|
<summary>
|
||||||
开启事务(不支持异步),60秒未执行完成(可能)被其他线程事务自动提交
|
开启事务(不支持异步),60秒未执行完成(可能)被其他线程事务自动提交
|
||||||
|
@ -24,6 +24,14 @@ namespace FreeSql
|
|||||||
/// 数据库类型
|
/// 数据库类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
DataType DataType { get; }
|
DataType DataType { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// UseConnectionString 时候的值
|
||||||
|
/// </summary>
|
||||||
|
string ConnectionString { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// UseSalve 时候的值
|
||||||
|
/// </summary>
|
||||||
|
string[] SlaveConnectionStrings { get; }
|
||||||
|
|
||||||
#region 事务
|
#region 事务
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -24,14 +24,18 @@ namespace FreeSql.Internal.CommonProvider
|
|||||||
public IObjectPool<DbConnection> MasterPool { get; protected set; }
|
public IObjectPool<DbConnection> MasterPool { get; protected set; }
|
||||||
public List<IObjectPool<DbConnection>> SlavePools { get; } = new List<IObjectPool<DbConnection>>();
|
public List<IObjectPool<DbConnection>> SlavePools { get; } = new List<IObjectPool<DbConnection>>();
|
||||||
public DataType DataType { get; }
|
public DataType DataType { get; }
|
||||||
|
public string ConnectionString { get; }
|
||||||
|
public string[] SlaveConnectionStrings { get; }
|
||||||
protected CommonUtils _util { get; set; }
|
protected CommonUtils _util { get; set; }
|
||||||
protected int slaveUnavailables = 0;
|
protected int slaveUnavailables = 0;
|
||||||
private object slaveLock = new object();
|
private object slaveLock = new object();
|
||||||
private Random slaveRandom = new Random();
|
private Random slaveRandom = new Random();
|
||||||
|
|
||||||
public AdoProvider(DataType dataType)
|
public AdoProvider(DataType dataType, string connectionString, string[] slaveConnectionStrings)
|
||||||
{
|
{
|
||||||
this.DataType = dataType;
|
this.DataType = dataType;
|
||||||
|
this.ConnectionString = connectionString;
|
||||||
|
this.SlaveConnectionStrings = slaveConnectionStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoggerException(IObjectPool<DbConnection> pool, PrepareCommandResult pc, Exception ex, DateTime dt, StringBuilder logtxt, bool isThrowException = true)
|
void LoggerException(IObjectPool<DbConnection> pool, PrepareCommandResult pc, Exception ex, DateTime dt, StringBuilder logtxt, bool isThrowException = true)
|
||||||
|
@ -13,8 +13,8 @@ namespace FreeSql.MsAccess
|
|||||||
{
|
{
|
||||||
class MsAccessAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
class MsAccessAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
||||||
{
|
{
|
||||||
public MsAccessAdo() : base(DataType.MsAccess) { }
|
public MsAccessAdo() : base(DataType.MsAccess, null, null) { }
|
||||||
public MsAccessAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.MsAccess)
|
public MsAccessAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.MsAccess, masterConnectionString, slaveConnectionStrings)
|
||||||
{
|
{
|
||||||
base._util = util;
|
base._util = util;
|
||||||
if (connectionFactory != null)
|
if (connectionFactory != null)
|
||||||
|
@ -13,8 +13,8 @@ namespace FreeSql.MySql
|
|||||||
class MySqlAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
class MySqlAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
public MySqlAdo() : base(DataType.MySql) { }
|
public MySqlAdo() : base(DataType.MySql, null, null) { }
|
||||||
public MySqlAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.MySql)
|
public MySqlAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.MySql, masterConnectionString, slaveConnectionStrings)
|
||||||
{
|
{
|
||||||
base._util = util;
|
base._util = util;
|
||||||
if (connectionFactory != null)
|
if (connectionFactory != null)
|
||||||
|
@ -12,8 +12,8 @@ namespace FreeSql.Odbc.Dameng
|
|||||||
{
|
{
|
||||||
class OdbcDamengAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
class OdbcDamengAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
||||||
{
|
{
|
||||||
public OdbcDamengAdo() : base(DataType.OdbcDameng) { }
|
public OdbcDamengAdo() : base(DataType.OdbcDameng, null, null) { }
|
||||||
public OdbcDamengAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.OdbcDameng)
|
public OdbcDamengAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.OdbcDameng, masterConnectionString, slaveConnectionStrings)
|
||||||
{
|
{
|
||||||
base._util = util;
|
base._util = util;
|
||||||
if (connectionFactory != null)
|
if (connectionFactory != null)
|
||||||
|
@ -12,8 +12,8 @@ namespace FreeSql.Odbc.Default
|
|||||||
{
|
{
|
||||||
class OdbcAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
class OdbcAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
||||||
{
|
{
|
||||||
public OdbcAdo() : base(DataType.Odbc) { }
|
public OdbcAdo() : base(DataType.Odbc, null, null) { }
|
||||||
public OdbcAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.Odbc)
|
public OdbcAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.Odbc, masterConnectionString, slaveConnectionStrings)
|
||||||
{
|
{
|
||||||
base._util = util;
|
base._util = util;
|
||||||
if (connectionFactory != null)
|
if (connectionFactory != null)
|
||||||
|
@ -13,8 +13,8 @@ namespace FreeSql.Odbc.MySql
|
|||||||
class OdbcMySqlAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
class OdbcMySqlAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
public OdbcMySqlAdo() : base(DataType.OdbcMySql) { }
|
public OdbcMySqlAdo() : base(DataType.OdbcMySql, null, null) { }
|
||||||
public OdbcMySqlAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.OdbcMySql)
|
public OdbcMySqlAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.OdbcMySql, masterConnectionString, slaveConnectionStrings)
|
||||||
{
|
{
|
||||||
base._util = util;
|
base._util = util;
|
||||||
if (connectionFactory != null)
|
if (connectionFactory != null)
|
||||||
|
@ -12,8 +12,8 @@ namespace FreeSql.Odbc.Oracle
|
|||||||
{
|
{
|
||||||
class OdbcOracleAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
class OdbcOracleAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
||||||
{
|
{
|
||||||
public OdbcOracleAdo() : base(DataType.OdbcOracle) { }
|
public OdbcOracleAdo() : base(DataType.OdbcOracle, null, null) { }
|
||||||
public OdbcOracleAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.OdbcOracle)
|
public OdbcOracleAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.OdbcOracle, masterConnectionString, slaveConnectionStrings)
|
||||||
{
|
{
|
||||||
base._util = util;
|
base._util = util;
|
||||||
if (connectionFactory != null)
|
if (connectionFactory != null)
|
||||||
|
@ -13,8 +13,8 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
{
|
{
|
||||||
class OdbcPostgreSQLAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
class OdbcPostgreSQLAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
||||||
{
|
{
|
||||||
public OdbcPostgreSQLAdo() : base(DataType.OdbcPostgreSQL) { }
|
public OdbcPostgreSQLAdo() : base(DataType.OdbcPostgreSQL, null, null) { }
|
||||||
public OdbcPostgreSQLAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.OdbcPostgreSQL)
|
public OdbcPostgreSQLAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.OdbcPostgreSQL, masterConnectionString, slaveConnectionStrings)
|
||||||
{
|
{
|
||||||
base._util = util;
|
base._util = util;
|
||||||
if (connectionFactory != null)
|
if (connectionFactory != null)
|
||||||
|
@ -13,8 +13,8 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
{
|
{
|
||||||
class OdbcSqlServerAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
class OdbcSqlServerAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
||||||
{
|
{
|
||||||
public OdbcSqlServerAdo() : base(DataType.OdbcSqlServer) { }
|
public OdbcSqlServerAdo() : base(DataType.OdbcSqlServer, null, null) { }
|
||||||
public OdbcSqlServerAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.OdbcSqlServer)
|
public OdbcSqlServerAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.OdbcSqlServer, masterConnectionString, slaveConnectionStrings)
|
||||||
{
|
{
|
||||||
base._util = util;
|
base._util = util;
|
||||||
if (connectionFactory != null)
|
if (connectionFactory != null)
|
||||||
|
@ -12,8 +12,8 @@ namespace FreeSql.Oracle
|
|||||||
{
|
{
|
||||||
class OracleAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
class OracleAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
||||||
{
|
{
|
||||||
public OracleAdo() : base(DataType.Oracle) { }
|
public OracleAdo() : base(DataType.Oracle, null, null) { }
|
||||||
public OracleAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.Oracle)
|
public OracleAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.Oracle, masterConnectionString, slaveConnectionStrings)
|
||||||
{
|
{
|
||||||
base._util = util;
|
base._util = util;
|
||||||
if (connectionFactory != null)
|
if (connectionFactory != null)
|
||||||
|
@ -14,8 +14,8 @@ namespace FreeSql.PostgreSQL
|
|||||||
{
|
{
|
||||||
class PostgreSQLAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
class PostgreSQLAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
||||||
{
|
{
|
||||||
public PostgreSQLAdo() : base(DataType.PostgreSQL) { }
|
public PostgreSQLAdo() : base(DataType.PostgreSQL, null, null) { }
|
||||||
public PostgreSQLAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.PostgreSQL)
|
public PostgreSQLAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.PostgreSQL, masterConnectionString, slaveConnectionStrings)
|
||||||
{
|
{
|
||||||
base._util = util;
|
base._util = util;
|
||||||
if (connectionFactory != null)
|
if (connectionFactory != null)
|
||||||
|
@ -13,8 +13,8 @@ namespace FreeSql.SqlServer
|
|||||||
{
|
{
|
||||||
class SqlServerAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
class SqlServerAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
||||||
{
|
{
|
||||||
public SqlServerAdo() : base(DataType.SqlServer) { }
|
public SqlServerAdo() : base(DataType.SqlServer, null, null) { }
|
||||||
public SqlServerAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.SqlServer)
|
public SqlServerAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.SqlServer, masterConnectionString, slaveConnectionStrings)
|
||||||
{
|
{
|
||||||
base._util = util;
|
base._util = util;
|
||||||
if (connectionFactory != null)
|
if (connectionFactory != null)
|
||||||
|
@ -13,8 +13,8 @@ namespace FreeSql.Sqlite
|
|||||||
{
|
{
|
||||||
class SqliteAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
class SqliteAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
||||||
{
|
{
|
||||||
public SqliteAdo() : base(DataType.Sqlite) { }
|
public SqliteAdo() : base(DataType.Sqlite, null, null) { }
|
||||||
public SqliteAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.Sqlite)
|
public SqliteAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.Sqlite, masterConnectionString, slaveConnectionStrings)
|
||||||
{
|
{
|
||||||
base._util = util;
|
base._util = util;
|
||||||
if (connectionFactory != null)
|
if (connectionFactory != null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user