Exemplo n.º 1
0
        public Type GetTypeForName(String name)
        {
            Type   entityType = null;
            String name2      = null;

            entityType = AssemblyHelper.GetTypeFromAssemblies(name);
            if (entityType == null)
            {
                name2      = StringConversionHelper.PackageNameToNameSpace(name);
                entityType = AssemblyHelper.GetTypeFromAssemblies(name2);
            }

            if (entityType == null && Log.ErrorEnabled)
            {
                String message;
                if (name2 == null)
                {
                    message = "Configured type '" + name + "' was not found";
                }
                else
                {
                    message = "Configured type '" + name + "' was not found (also not '" + name2 + "')";
                }
                throw new Exception(message);
            }

            return(entityType);
        }
Exemplo n.º 2
0
        protected String GetRequiredAttribute(XElement element, XName attrName, bool required, bool firstToUpper)
        {
            XAttribute attribute = element.Attribute(attrName);
            String     value;

            if (attribute == null)
            {
                if (required)
                {
                    throw new ArgumentException("Attribute '" + attrName.LocalName + "' has to be set on tag '" + element.Name + "'");
                }
                value = "";
            }
            else
            {
                value = attribute.Value;
            }
            if (required && value.Length == 0)
            {
                throw new ArgumentException("Attribute '" + attrName.LocalName + "' has to be set on tag '" + element.Name + "'");
            }
            if (firstToUpper)
            {
                value = StringConversionHelper.UpperCaseFirst(value);
            }
            return(value);
        }