Ejemplo n.º 1
0
        private Type ResolveType(string namespacePrefix, string typeName)
        {
            if (string.IsNullOrEmpty(namespacePrefix))
            {
                namespacePrefix = PrefixDefaultNamespace;
            }

            var      nsAsmInfo    = NamespaceAssemblyInfo.GetNamespaceAssemblyInfo(namespaceAssemblyInfoDictionary, namespacePrefix);
            string   typeFullName = string.Concat(nsAsmInfo.ClrNamespace, ".", typeName);
            Assembly assembly     = nsAsmInfo.Assembly;
            Type     type         = assembly != null?assembly.GetType(typeFullName) : Type.GetType(typeFullName);

            if (type == null)
            {
                throw new ApplicationException(string.Format("Type '{0}' not found.", typeFullName));
            }

            return(type);
        }
Ejemplo n.º 2
0
        private void PopulateNamespaceAssemblyInfoDictionary(XmlDocument xmlDoc)
        {
            if (namespaceAssemblyInfoDictionary.Count > 0)
            {
                return;
            }

            foreach (XmlAttribute xmlAttribute in xmlDoc.DocumentElement.Attributes)
            {
                if (xmlAttribute.LocalName == XmlNamespaceAttribute)
                {
                    NamespaceAssemblyInfo.AddEntry(namespaceAssemblyInfoDictionary, PrefixDefaultNamespace, xmlAttribute.Value);
                }

                if (xmlAttribute.Prefix == XmlNamespaceAttribute)
                {
                    NamespaceAssemblyInfo.AddEntry(namespaceAssemblyInfoDictionary, xmlAttribute.LocalName, xmlAttribute.Value);
                }
            }
        }