GetStartupConfigRoot() public static method

public static GetStartupConfigRoot ( ) : System.Xml.Linq.XElement
return System.Xml.Linq.XElement
Example #1
0
        public override void BuildSteps()
        {
            var startupRoot = ConfigurationHelper.GetStartupConfigRoot();

            if (!startupRoot.IsNull())
            {
                //加载ResourceModules
                var resourcesTypes  = startupRoot.GetAtrriuteValues("Type", new string[] { ConfigurationHelper.Config_Node_Modules, ConfigurationHelper.Config_Node_ResourceModules, ConfigurationHelper.Config_Node_Operation });
                var resourceModules = new List <IResourceModule>();
                foreach (var type in resourcesTypes)
                {
                    resourceModules.Add(CreateInstanceByType <IResourceModule>(type));
                }
                this.ThemeResourceModules.AddRange(resourceModules.Where(res => res is IThemeResourceModule).Cast <IThemeResourceModule>());
                this.LanguageResourceMudules.AddRange(resourceModules.Where(res => res is ILanguageResourceModule).Cast <ILanguageResourceModule>());
                //加载LoginModules
                var loginTypes = startupRoot.GetAtrriuteValues("Type", new string[] { ConfigurationHelper.Config_Node_Modules, ConfigurationHelper.Config_Node_LoginModules, ConfigurationHelper.Config_Node_Operation });
                foreach (var type in loginTypes)
                {
                    this.LoginModules.Add(CreateInstanceByType <ILoginModule>(type));
                }
                //加载AuthenticationModules
                var authenticationTypes = startupRoot.GetAtrriuteValues("Type", new string[] { ConfigurationHelper.Config_Node_Modules, ConfigurationHelper.Config_Node_AuthenticationModules, ConfigurationHelper.Config_Node_Operation });
                foreach (var type in authenticationTypes)
                {
                    this.AuthenticationModules.Add(CreateInstanceByType <IAuthenticationModule>(type));
                }
                //加载AutorizationModules
                var authorizationTypes = startupRoot.GetAtrriuteValues("Type", new string[] { ConfigurationHelper.Config_Node_Modules, ConfigurationHelper.Config_Node_AuthorizationModules, ConfigurationHelper.Config_Node_Operation });
                foreach (var type in authorizationTypes)
                {
                    this.AuthorizationModules.Add(CreateInstanceByType <IAuthorizationModule>(type));
                }
                //加载执行流程
                var executionTypes = startupRoot.GetAtrriuteValues("Type", new string[] { ConfigurationHelper.Config_Node_Modules, ConfigurationHelper.Config_Node_ExecutionModules, ConfigurationHelper.Config_Node_Operation });
                foreach (var type in executionTypes)
                {
                    this.ExecutionModules.Add(CreateInstanceByType <IExecutionModule>(type));
                }
            }
        }
        public override void BuildSteps()
        {
            #region Application Attributes
            var applicationRoot = ConfigurationHelper.GetApplicationConfigRoot();
            if (!applicationRoot.IsNull())
            {
                var eleLayouts = new string[] { ConfigurationHelper.Config_Node_Attriutes, ConfigurationHelper.Config_Node_Attr };
                var attributes = applicationRoot.GetElements(eleLayouts);
                foreach (var element in attributes)
                {
                    var name  = element.GetAttributeValue("Name");
                    var value = element.GetAttributeValue("Value");

                    if (!this.Data.ContainsKey(name))
                    {
                        this.Data.Add(name, value);
                    }
                }
            }
            #endregion

            #region Startup
            var startupRoot = ConfigurationHelper.GetStartupConfigRoot();
            if (!startupRoot.IsNull())
            {
                //加载ResourceModules
                var startups        = startupRoot.GetElements(new string[] { ConfigurationHelper.Config_Node_Modules, ConfigurationHelper.Config_Node_ResourceModules, ConfigurationHelper.Config_Node_Operation });
                var resourcesTypes  = startups.ToList().Select(el => el.GetAttributeValue("Type"));
                var resourceModules = new List <IResourceModule>();
                foreach (var type in resourcesTypes)
                {
                    resourceModules.Add(CreateInstanceByType <IResourceModule>(type));
                }
                this.ThemeResourceModules.AddRange(resourceModules.Where(res => res is IThemeResourceModule).Cast <IThemeResourceModule>());
                this.LanguageResourceMudules.AddRange(resourceModules.Where(res => res is ILanguageResourceModule).Cast <ILanguageResourceModule>());
                //加载LoginModules
                var loginTypes = startupRoot.GetElements(new string[] { ConfigurationHelper.Config_Node_Modules, ConfigurationHelper.Config_Node_LoginModules, ConfigurationHelper.Config_Node_Operation }).ToList().Select(el => el.GetAttributeValue("Type"));
                foreach (var type in loginTypes)
                {
                    this.LoginModules.Add(CreateInstanceByType <ILoginModule>(type));
                }
                //加载AuthenticationModules
                var authenticationTypes = startupRoot.GetElements(new string[] { ConfigurationHelper.Config_Node_Modules, ConfigurationHelper.Config_Node_AuthenticationModules, ConfigurationHelper.Config_Node_Operation }).ToList().Select(el => el.GetAttributeValue("Type"));
                foreach (var type in authenticationTypes)
                {
                    this.AuthenticationModules.Add(CreateInstanceByType <IAuthenticationModule>(type));
                }
                //加载AutorizationModules
                var authorizationTypes = startupRoot.GetElements(new string[] { ConfigurationHelper.Config_Node_Modules, ConfigurationHelper.Config_Node_AuthorizationModules, ConfigurationHelper.Config_Node_Operation }).ToList().Select(el => el.GetAttributeValue("Type"));
                foreach (var type in authorizationTypes)
                {
                    this.AuthorizationModules.Add(CreateInstanceByType <IAuthorizationModule>(type));
                }
                //加载执行流程
                var executionTypes = startupRoot.GetElements(new string[] { ConfigurationHelper.Config_Node_Modules, ConfigurationHelper.Config_Node_ExecutionModules, ConfigurationHelper.Config_Node_Operation }).ToList().Select(el => el.GetAttributeValue("Type"));
                foreach (var type in executionTypes)
                {
                    this.ExecutionModules.Add(CreateInstanceByType <IExecutionModule>(type));
                }
            }

            #endregion
        }