Beispiel #1
0
 /// <summary>
 /// 创建一个 <see cref="Wunion.DataAdapter.Kernel.QuickDataChanger"/> 的对象实例。
 /// </summary>
 /// <param name="engine">执行数据库交互的引擎对象。</param>
 public QuickDataChanger(DataEngine engine = null)
 {
     _Conditions = new List <object>();
     Trans       = null;
     if (engine == null)
     {
         _Engine = DataEngine.CurrentEngine;
     }
     else
     {
         _Engine = engine;
     }
 }
Beispiel #2
0
 /// <summary>
 /// 创建一个与事务关联的 <see cref="Wunion.DataAdapter.Kernel.QuickDataChanger"/> 对象实例。
 /// </summary>
 /// <param name="transController">关联到该对象的事务控制器。</param>
 /// <param name="engine">执行数据库交互的引擎对象。</param>
 public QuickDataChanger(DBTransactionController transController, DataEngine engine = null)
 {
     _Conditions = new List <object>();
     Trans       = transController;
     if (engine == null)
     {
         _Engine = DataEngine.CurrentEngine;
     }
     else
     {
         _Engine = engine;
     }
 }
        /// <summary>
        /// 清理引擎池中,除默认引擎外的所有其他引擎。
        /// </summary>
        public static void EnginePoolsClean()
        {
            if (DataEnginePools == null)
            {
                return;
            }
            DataEngine Default = DataEnginePools["Default"];

            DataEnginePools.Clear();
            DataEnginePools.Add("Default", Default);
            // 清理完成后将当前引擎设置为默认引擎,不然如果当前引擎已被切换为默认引擎以外的其它引擎时就会出错。
            DataEngine.CurrentEngine = Default;
            _CurrentEngineStatus     = ENGINE_IS_DEFAULT;
        }
        /// <summary>
        /// 向引擎池中添加一个引擎(注:需要在组件的支持范围内)。
        /// </summary>
        /// <param name="Dba">该引擎与数据库进行交互的访问器。</param>
        /// <param name="parserAdapter">该引擎用的解析命令的适配器。</param>
        /// <param name="key">该引擎在引擎池中的键名称。</param>
        public static void AppendDataEngine(DbAccess Dba, ParserAdapter parserAdapter, string key = "Default")
        {
            if (DataEnginePools == null)
            {
                DataEnginePools = new Dictionary <string, DataEngine>();
            }
            if (DataEnginePools.ContainsKey(key))
            {
                return;
            }
            DataEngine Engine = new DataEngine(Dba, parserAdapter);

            DataEnginePools.Add(key, Engine);
            if (key.ToUpper() == "DEFAULT")
            {
                DataEngine.CurrentEngine = Engine;
            }
        }
Beispiel #5
0
 /// <summary>
 /// 创建一个 <see cref="BatchCommander"/> 的对象实例.
 /// </summary>
 /// <param name="database">此提供程序使用的数据库引擎.</param>
 public BatchCommander(DataEngine database)
 {
     Engine = database;
 }