Esempio n. 1
0
        protected void Application_Start()
        {
            GlobalConfiguration.Configure(WebApiConfig.Configure);

            // Setup outbound connections settings
            // http://blogs.msdn.com/b/windowsazurestorage/archive/2010/11/06/how-to-get-most-out-of-windows-azure-tables.aspx#_Toc276237444
            ServicePointManager.DefaultConnectionLimit = int.MaxValue;
            ServicePointManager.UseNagleAlgorithm      = false;
            ServicePointManager.Expect100Continue      = false;

            // Start scheduled tasks updater
            _taskStateManager = GetService <ITaskStateManager>();
            _taskStateManager.Start();
        }
Esempio n. 2
0
        /// <summary>
        /// 按config文件夹中的TaskState.xml配置文件加任务等级
        /// </summary>
        private void LoadTaskState()
        {
            string xmlPath = "~/Config/TaskState.xml";
            IApplicationContext      cxt           = ContextRegistry.GetContext();
            ITaskStateManager        manger        = (ITaskStateManager)cxt.GetObject("Manager.TaskState");
            IList <Domain.TaskState> taskStateList = manger.LoadAll();

            if (taskStateList.Count == 0)
            {
                //manger.LoadSystemModelWithXML();
                // 把xml文件转换成dataSet
                Atom.Common.XML.XMLProcess xmlProcess = new Atom.Common.XML.XMLProcess();
                DataSet xmlDS = xmlProcess.GetDataSetByXml(xmlPath);
                // 生成目录
                for (int i = 0; i < xmlDS.Tables[0].Rows.Count; i++)
                {
                    Domain.TaskState entity = new Domain.TaskState();
                    entity.ID         = Guid.NewGuid();
                    entity.StateName  = xmlDS.Tables[0].Rows[i]["name"].ToStr();
                    entity.OrderIndex = xmlDS.Tables[0].Rows[i]["orderIndex"].ToInt();
                    manger.Save(entity);
                }
            }
        }