Beispiel #1
0
 public static void Start(IRunner runner, RunType runType)
 {
     runner.Init(runType);
     CodeTimer.Time(
         runner.Name
         , Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["Iteration"] ?? "10000")
         , () => runner.Start());
 }
Beispiel #2
0
        public bool Run(BehindCodeItem compileCode, string callModuleName, ISysDesign callModule, object sender, object eventArgs, string actName, string actTag,
                        IBizDataItems sourceBizDatas, out IBizDataItems processBizDatas, bool isBuffer = true)
        {
            processBizDatas = null;

            if (_compilerObj == null)
            {
                _compilerObj = new Dictionary <string, IRunner>();
            }

            if (_isAllowDebug)
            {
                _compilerObj.Remove(compileCode.FuncName);
            }

            IRunner runner = null;

            if (_compilerObj.ContainsKey(compileCode.FuncName))
            {
                runner = _compilerObj[compileCode.FuncName];
            }
            else
            {
                runner = CompilerCode(compileCode);

                if (isBuffer && _isAllowDebug == false)
                {
                    //缓存编译对象
                    //调试状态不缓存编译对象
                    _compilerObj.Add(compileCode.FuncName, runner);
                }
            }

            if (runner != null)
            {
                IDBQuery thridDb = null;

                if (string.IsNullOrEmpty(compileCode.ThridDBAlias) == false)
                {
                    string strErr = "";
                    thridDb = SqlHelper.GetThridDBHelper(compileCode.ThridDBAlias, _dbHelper, ref strErr);
                    if (thridDb == null)
                    {
                        MessageBox.Show("动态方法 [" + compileCode.FuncName + "] 对应的数据源 [" + compileCode.ThridDBAlias + "] 链接对象创建失败," + strErr, "提示");
                        return(false);
                    }
                }

                runner.Init(_winRelateModules, _dbHelper, thridDb, _userData, _stationInfo, _dataTransCenter, _owiner);
                return(runner.Run(callModuleName, callModule, sender, eventArgs, actName, actTag, sourceBizDatas, out processBizDatas));
            }

            return(false);
        }