/// <summary> /// 初始化数据库环境(共享自其它上下文)、实例化子类中,所有Set属性 /// </summary> /// <param name="currentContextType">外部上下文类型</param> /// <param name="masterContext">其它上下文(主上下文)</param> public InternalContext(Type currentContextType, InternalContext masterContext) { this.ContextType = currentContextType; this._contextConnection = masterContext._contextConnection; // 上下文映射关系 ContextMap = new ContextDataMap(ContextType); // 手动编写SQL ManualSql = masterContext.ManualSql; // 默认SQL执行者 Executeor = masterContext.Executeor; // 数据库提供者 DbProvider = masterContext.DbProvider; // 队列管理者 QueueManger = masterContext.QueueManger; IsInitializer = true; }
/// <summary> /// 初始化数据库环境(共享自其它上下文)、实例化子类中,所有Set属性 /// </summary> /// <param name="currentContextType">外部上下文类型</param> /// <param name="masterContext">其它上下文(主上下文)</param> public void TransactionInstance(Type currentContextType, InternalContext masterContext) { this.ContextType = currentContextType; this.IsUnitOfWork = masterContext.IsUnitOfWork; // 连接字符串 this.ContextConnection = masterContext.ContextConnection; // 手动编写SQL ManualSql = masterContext.ManualSql; // 默认SQL执行者 Executeor = masterContext.Executeor; // 数据库提供者 DbProvider = masterContext.DbProvider; // 队列管理者 QueueManger = masterContext.QueueManger; // 上下文映射关系 ContextMap = new ContextDataMap(ContextType); // 不再需要初始化 IsInitializer = true; }