예제 #1
0
        public EngineMain(EventLog serviceEventLog = null)
        {
            _MainDbAccess = DbPackage.CreateConnection();
            _DbServerEnv  = _MainDbAccess.GetDbServerEnv();

            _MainDbAccess.LoadEngineConfig();
            _ServiceEventLog = serviceEventLog;
            _TemplateManager = new TemplateManager();
        }
예제 #2
0
        public void BuildWorkitems(DbAccess dbAccess, TemplateManager templateManager, DbmsEnvironment dbServerEnv)
        {
            TemplateContext defaultProperties;
            Type            templateClass;

            _Workitems = dbAccess.LoadWorkitems(_Workitem_Table_Name).ToList();

            foreach (Workitem wi in _Workitems)
            {
                if (templateManager.TemplateDefaultProperties.TryGetValue(wi.Template_Name, out defaultProperties))
                {
                    wi.WorkingProperties = defaultProperties.Copy();
                }
                else
                {
                    wi.WorkingProperties = new TemplateContext(dbServerEnv);
                }

                if (templateManager.TemplateClassDictionary.TryGetValue(wi.Template_Name, out templateClass))
                {
                    wi.TemplateClass = templateClass;
                }
            }

            dbAccess.LoadWorkingProperties(_Property_Table_Name, row =>
            {
                SetWorkingProperty(row.Field <string>("WORKITEM_NAME"), row.Field <string>("PROPERTY_NAME"),
                                   row.Field <string>("STRING_VALUE") ?? string.Empty, row.Field <string>("LINK_STATE") ?? string.Empty);
            });

            foreach (Workitem wi in _Workitems)
            {
                wi.Compile();

                dbAccess.CompileWorkitem(_Workitem_Table_Name, wi.Workitem_Name, wi.Compiled_Error, wi.Object_Code);
            }
        }