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:
@ -13,10 +13,15 @@ namespace FreeSql.Odbc.SqlServer
|
||||
{
|
||||
class OdbcSqlServerAdo : FreeSql.Internal.CommonProvider.AdoProvider
|
||||
{
|
||||
public OdbcSqlServerAdo() : base(DataType.SqlServer) { }
|
||||
public OdbcSqlServerAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings) : base(DataType.SqlServer)
|
||||
public OdbcSqlServerAdo() : base(DataType.OdbcSqlServer) { }
|
||||
public OdbcSqlServerAdo(CommonUtils util, string masterConnectionString, string[] slaveConnectionStrings, Func<DbConnection> connectionFactory) : base(DataType.OdbcSqlServer)
|
||||
{
|
||||
base._util = util;
|
||||
if (connectionFactory != null)
|
||||
{
|
||||
MasterPool = new FreeSql.Internal.CommonProvider.DbConnectionPool(DataType.OdbcSqlServer, connectionFactory);
|
||||
return;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(masterConnectionString))
|
||||
MasterPool = new OdbcSqlServerConnectionPool("主库", masterConnectionString, null, null);
|
||||
if (slaveConnectionStrings != null)
|
||||
@ -73,9 +78,11 @@ namespace FreeSql.Odbc.SqlServer
|
||||
return new OdbcCommand();
|
||||
}
|
||||
|
||||
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 OdbcSqlServerConnectionPool).Return(conn, ex);
|
||||
var rawPool = pool as OdbcSqlServerConnectionPool;
|
||||
if (rawPool != null) rawPool.Return(conn, ex);
|
||||
else pool.Return(conn);
|
||||
}
|
||||
|
||||
protected override DbParameter[] GetDbParamtersByObject(string sql, object obj) => _util.GetDbParamtersByObject(sql, obj);
|
||||
|
@ -3,6 +3,7 @@ using FreeSql.Internal.CommonProvider;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Threading;
|
||||
|
||||
namespace FreeSql.Odbc.SqlServer
|
||||
@ -27,12 +28,12 @@ namespace FreeSql.Odbc.SqlServer
|
||||
public IAop Aop { get; }
|
||||
public ICodeFirst CodeFirst { get; }
|
||||
public IDbFirst DbFirst { get; }
|
||||
public OdbcSqlServerProvider(string masterConnectionString, string[] slaveConnectionString)
|
||||
public OdbcSqlServerProvider(string masterConnectionString, string[] slaveConnectionString, Func<DbConnection> connectionFactory = null)
|
||||
{
|
||||
this.InternalCommonUtils = new OdbcSqlServerUtils(this);
|
||||
this.InternalCommonExpression = new OdbcSqlServerExpression(this.InternalCommonUtils);
|
||||
|
||||
this.Ado = new OdbcSqlServerAdo(this.InternalCommonUtils, masterConnectionString, slaveConnectionString);
|
||||
this.Ado = new OdbcSqlServerAdo(this.InternalCommonUtils, masterConnectionString, slaveConnectionString, connectionFactory);
|
||||
this.Aop = new AopProvider();
|
||||
|
||||
this.DbFirst = new OdbcSqlServerDbFirst(this, this.InternalCommonUtils, this.InternalCommonExpression);
|
||||
|
Reference in New Issue
Block a user