Exemple #1
0
        /// <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;
        }
        /// <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;
        }
        /// <summary>
        /// 初始化数据库环境、实例化子类中,所有Set属性
        /// </summary>
        public void Initializer()
        {
            if (IsInitializer) { return; }

            // 默认SQL执行者
            Executeor = new ExecuteSql(new DbExecutor(_contextConnection.ConnectionString, _contextConnection.DbType, _contextConnection.CommandTimeout, IsMergeCommand ? IsolationLevel.Serializable : IsolationLevel.Unspecified), this);
            // 代理SQL记录
            if (SystemConfigs.ConfigEntity.IsWriteDbLog) { Executeor = new ExecuteSqlLogProxy(Executeor); }
            // 代理异常记录
            if (SystemConfigs.ConfigEntity.IsWriteDbExceptionLog) { Executeor = new ExecuteSqlExceptionLogProxy(Executeor); }

            // 数据库提供者
            DbProvider = AbsDbProvider.CreateInstance(Executeor.DataBase.DataType, _contextConnection.DataVer);
            // 队列管理者
            QueueManger = new QueueManger(this);
            // 手动编写SQL
            ManualSql = new ManualSql(this);
            // 上下文映射关系
            this.ContextMap = new ContextDataMap(ContextType);

            IsInitializer = true;
        }
        /// <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, !IsUnitOfWork && DbProvider.IsSupportTransaction ? IsolationLevel.RepeatableRead : IsolationLevel.Unspecified), this);
            // 代理SQL记录
            if (SystemConfigs.ConfigEntity.IsWriteSqlRunLog) { Executeor = new ExecuteSqlLogProxy(Executeor); }
            // 代理异常记录
            if (SystemConfigs.ConfigEntity.IsWriteSqlErrorLog) { Executeor = new ExecuteSqlExceptionLogProxy(Executeor); }

            // 队列管理者
            QueueManger = new QueueManger(this);
            // 手动编写SQL
            ManualSql = new ManualSql(this);
            // 上下文映射关系
            this.ContextMap = new ContextDataMap(ContextType);

            IsInitializer = true;
        }