/// <summary> /// 初始化数据库环境、实例化子类中,所有Set属性 /// </summary> public void Initializer() { if (IsInitializer) { return; } // 数据库提供者 DbProvider = AbsDbProvider.CreateInstance(ContextConnection.DbType, ContextConnection.DataVer); var dbconfig = IocManager.Instance.Resolve <IConfigResolver>().DbConfig(); // 默认SQL执行者 Executeor = new ExecuteSql(new DbExecutor(ContextConnection.ConnectionString, ContextConnection.DbType, ContextConnection.CommandTimeout, !IsUnitOfWork && DbProvider.IsSupportTransaction ? IsolationLevel.RepeatableRead : IsolationLevel.Unspecified), this); // 代理SQL监控 if (IocManager.Instance.IsRegistered <ISqlMonitor>()) { Executeor = new ExecuteSqlMonitorProxy(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(); } }