Пример #1
0
        /// <summary>
        /// Run startup tasks
        /// </summary>
        protected virtual void RunStartupTasks()
        {
            var typeFinder       = _containerManager.Resolve <ITypeFinder>();
            var startUpTaskTypes = typeFinder.FindClassesOfType <IStartupTask>();
            var startUpTasks     = new List <IStartupTask>();

            foreach (var startUpTaskType in startUpTaskTypes)
            {
                startUpTasks.Add((IStartupTask)Activator.CreateInstance(startUpTaskType));
            }
            //sort
            startUpTasks = startUpTasks.AsQueryable().OrderBy(st => st.Order).ToList();
            foreach (var startUpTask in startUpTasks)
            {
                startUpTask.Execute();
            }
        }