GetType() public static method

public static GetType ( String typeName ) : Type
typeName String
return System.Type
Example #1
0
        /// <summary>
        /// Deserializes the specified section.
        /// </summary>
        /// <param name="section">The section.</param>
        public void Deserialize(XmlNode section)
        {
            var customFactoryNode = section.SelectSingleNode("customComponentFactory");

            if (customFactoryNode != null)
            {
                var typeAtt = customFactoryNode.Attributes["type"];

                if (typeAtt == null || typeAtt.Value == String.Empty)
                {
                    var message = "If the node customComponentFactory is " +
                                  "present, you must specify the 'type' attribute";
                    throw new ConfigurationErrorsException(message);
                }

                var typeName = typeAtt.Value;

                customFactory = TypeLoadUtil.GetType(typeName);
            }

            var nodeList = section.SelectNodes("viewcomponents/assembly");

            var items = new ArrayList();

            foreach (XmlNode node in nodeList)
            {
                items.Add(node.ChildNodes[0].Value);
            }

            assemblies = (String[])items.ToArray(typeof(String));
        }
Example #2
0
        /// <summary>
        /// Deserializes the specified section.
        /// </summary>
        /// <param name="section">The section.</param>
        public void Deserialize(XmlNode section)
        {
            var customFactoryNode = section.SelectSingleNode("customControllerFactory");

            if (customFactoryNode != null)
            {
                var typeAtt = customFactoryNode.Attributes["type"];

                if (typeAtt == null || typeAtt.Value == String.Empty)
                {
                    var message = "If the node customControllerFactory is " +
                                  "present, you must specify the 'type' attribute";
                    throw new ConfigurationErrorsException(message);
                }

                var typeName = typeAtt.Value;

                customControllerFactory = TypeLoadUtil.GetType(typeName);
            }

            var nodeList = section.SelectNodes("controllers/assembly");

            foreach (XmlNode node in nodeList)
            {
                if (node.HasChildNodes)
                {
                    assemblies.Add(node.ChildNodes[0].Value);
                }
            }
        }
Example #3
0
        private void ConfigureSingleViewEngine(XmlNode section)
        {
            section = section.SelectSingleNode("viewEngine");

            if (section == null)
            {
                ConfigureDefaultViewEngine();

                return;
            }

            var viewPath = section.Attributes["viewPathRoot"];

            if (viewPath == null)
            {
                viewPathRoot = virtualPathRoot = "views";
            }
            else
            {
                viewPathRoot = virtualPathRoot = viewPath.Value;
            }

            var xhtmlRendering = section.Attributes["xhtmlRendering"];

            var enableXhtmlRendering = false;

            if (xhtmlRendering != null)
            {
                try
                {
                    enableXhtmlRendering = xhtmlRendering.Value.ToLowerInvariant() == "true";
                }
                catch (FormatException ex)
                {
                    const string message = "The xhtmlRendering attribute of the views node must be a boolean value.";
                    throw new ConfigurationErrorsException(message, ex);
                }
            }

            var customEngineAtt = section.Attributes["customEngine"];

            var engineType = typeof(Views.Aspx.WebFormsViewEngine);

            if (customEngineAtt != null)
            {
                engineType = TypeLoadUtil.GetType(customEngineAtt.Value);
            }

            viewEngines.Add(new ViewEngineInfo(engineType, enableXhtmlRendering));
        }
        /// <summary>
        /// Deserializes the specified section.
        /// </summary>
        /// <param name="section">The section.</param>
        public void Deserialize(XmlNode section)
        {
            var typeAtt = section.Attributes["type"];

            if (typeAtt == null || typeAtt.Value == String.Empty)
            {
                var message = "To add a service, please specify the 'type' attribute. " +
                              "Check the documentation for more information";
                throw new ConfigurationErrorsException(message);
            }

            extensionType = TypeLoadUtil.GetType(typeAtt.Value);

            extensionNode = XmlConfigurationDeserializer.GetDeserializedNode(section);
        }
Example #5
0
        private void ProcessFilterFactoryNode(XmlNode node)
        {
            if (node == null)
            {
                return;
            }

            var type = node.Attributes["type"];

            if (type == null)
            {
                var message = "The custom filter factory node must specify a 'type' attribute";
                throw new ConfigurationErrorsException(message);
            }

            customFilterFactory = TypeLoadUtil.GetType(type.Value);
        }
Example #6
0
        /// <summary>
        /// Deserializes the configuration section looking
        /// for a 'scaffold' element with a 'type' attribute
        /// </summary>
        /// <param name="section">The section.</param>
        public void Deserialize(XmlNode section)
        {
            section = section.SelectSingleNode("scaffold");

            if (section == null)
            {
                return;
            }

            var typeAtt = section.Attributes["type"];

            if (typeAtt == null || typeAtt.Value == String.Empty)
            {
                var message = "Please specify the 'type' attribute to define an implementation for scaffolding support";
                throw new ConfigurationErrorsException(message);
            }

            scaffoldImplType = TypeLoadUtil.GetType(typeAtt.Value);
        }
Example #7
0
        private void ConfigureMultipleViewEngines(XmlElement engines)
        {
            viewPathRoot = engines.GetAttribute("viewPathRoot");

            if (string.IsNullOrEmpty(viewPathRoot))
            {
                viewPathRoot = "views";
            }

            foreach (XmlElement addNode in engines.SelectNodes("add"))
            {
                var typeName = addNode.GetAttribute("type");
                var xhtmlVal = addNode.GetAttribute("xhtml");

                if (string.IsNullOrEmpty(typeName))
                {
                    const string message = "The attribute 'type' is required for the element 'add' under 'viewEngines'";
                    throw new ConfigurationErrorsException(message);
                }

                var engine = TypeLoadUtil.GetType(typeName, true);

                if (engine == null)
                {
                    var message = "The type '" + typeName + "' could not be loaded";
                    throw new ConfigurationErrorsException(message);
                }

                viewEngines.Add(new ViewEngineInfo(engine, xhtmlVal == "true"));
            }

            if (viewEngines.Count == 0)
            {
                ConfigureDefaultViewEngine();
            }
        }