/// <summary> /// 初始化数据库环境、实例化子类中,所有Set属性 /// </summary> public void Initializer() { if (IsInitializer) { return; } // 数据库提供者 DbProvider = AbsDbProvider.CreateInstance(_contextConnection.DbType, _contextConnection.DataVer); // 默认SQL执行者 Executeor = new ExecuteSql(new DbExecutor(_contextConnection.ConnectionString, _contextConnection.DbType, _contextConnection.CommandTimeout, IsMergeCommand && DbProvider.IsSupportTransaction ? IsolationLevel.Serializable : IsolationLevel.Unspecified), this); // 代理SQL记录 if (SystemConfigs.ConfigEntity.IsWriteDbLog) { Executeor = new ExecuteSqlLogProxy(Executeor); } // 代理异常记录 if (SystemConfigs.ConfigEntity.IsWriteDbExceptionLog) { Executeor = new ExecuteSqlExceptionLogProxy(Executeor); } // 队列管理者 QueueManger = new QueueManger(this); // 手动编写SQL ManualSql = new ManualSql(this); // 上下文映射关系 this.ContextMap = new ContextDataMap(ContextType); IsInitializer = true; }
protected virtual void Dispose(bool disposing) { //释放托管资源 if (disposing) { QueueManger.Dispose(); Executeor.DataBase.Dispose(); } }