mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 04:18:16 +08:00
- 增加 Where In 表达式解析;
- 增加 FreeSqlBuilder.UseConnectionFactory 自定义数据库连接对象的创建方法;
This commit is contained in:
@ -14,9 +14,14 @@ namespace FreeSql.MySql
|
||||
{
|
||||
|
||||
public MySqlAdo() : base(DataType.MySql) { }
|
||||
public MySqlAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings) : base(DataType.MySql)
|
||||
public MySqlAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.MySql)
|
||||
{
|
||||
base._util = util;
|
||||
if (connectionFactory != null)
|
||||
{
|
||||
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.MySql, connectionFactory);
|
||||
return;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(masterConnectionString))
|
||||
MasterPool = new MySqlConnectionPool("主库", masterConnectionString, null, null);
|
||||
if (slaveConnectionStrings != null)
|
||||
@ -59,9 +64,11 @@ namespace FreeSql.MySql
|
||||
return new MySqlCommand();
|
||||
}
|
||||
|
||||
protected override void ReturnConnection(ObjectPool<DbConnection> pool, Object<DbConnection> conn, Exception ex)
|
||||
protected override void ReturnConnection(IObjectPool<DbConnection> pool, Object<DbConnection> conn, Exception ex)
|
||||
{
|
||||
(pool as MySqlConnectionPool).Return(conn, ex);
|
||||
var rawPool = pool as MySqlConnectionPool;
|
||||
if (rawPool != null) rawPool.Return(conn, ex);
|
||||
else pool.Return(conn);
|
||||
}
|
||||
|
||||
protected override DbParameter[] GetDbParamtersByObject(string sql, object obj) => _util.GetDbParamtersByObject(sql, obj);
|
||||
|
@ -55,12 +55,12 @@ namespace FreeSql.MySql
|
||||
public IAop Aop { get; }
|
||||
public ICodeFirst CodeFirst { get; }
|
||||
public IDbFirst DbFirst { get; }
|
||||
public MySqlProvider(string masterConnectionString, string[] slaveConnectionString)
|
||||
public MySqlProvider(string masterConnectionString, string[] slaveConnectionString, Func<DbConnection> connectionFactory = null)
|
||||
{
|
||||
this.InternalCommonUtils = new MySqlUtils(this);
|
||||
this.InternalCommonExpression = new MySqlExpression(this.InternalCommonUtils);
|
||||
|
||||
this.Ado = new MySqlAdo(this.InternalCommonUtils, masterConnectionString, slaveConnectionString);
|
||||
this.Ado = new MySqlAdo(this.InternalCommonUtils, masterConnectionString, slaveConnectionString, connectionFactory);
|
||||
this.Aop = new AopProvider();
|
||||
|
||||
this.DbFirst = new MySqlDbFirst(this, this.InternalCommonUtils, this.InternalCommonExpression);
|
||||
|
Reference in New Issue
Block a user