Exemple #1
0
        private static Attribute ConvertToDecimalMax(XmlNhvmRuleConverterArgs rule)
        {
            NhvmDecimalmax maxRule = (NhvmDecimalmax)rule.schemaRule;
            decimal        value   = decimal.MaxValue;

            if (maxRule.valueSpecified)
            {
                value = maxRule.value;
            }

#if NETFX
            log.Info(string.Format("Converting to DecimalMax attribute with value {0}", value));
#else
            Log.Info("Converting to DecimalMax attribute with value {0}", value);
#endif
            DecimalMaxAttribute thisAttribute = new DecimalMaxAttribute();
            thisAttribute.Value = value;

            if (maxRule.message != null)
            {
                thisAttribute.Message = maxRule.message;
            }
            AssignTagsFromString(thisAttribute, maxRule.tags);
            return(thisAttribute);
        }
Exemple #2
0
        private static Attribute ConvertToSize(XmlNhvmRuleConverterArgs rule)
        {
            NhvmSize sizeRule = (NhvmSize)rule.schemaRule;
            int      min      = int.MinValue;
            int      max      = int.MaxValue;

            if (sizeRule.minSpecified)
            {
                min = sizeRule.min;
            }

            if (sizeRule.maxSpecified)
            {
                max = sizeRule.max;
            }

            log.Info(string.Format("Converting to Size attribute with min {0}, max {1}", min, max));
            SizeAttribute thisAttribute = new SizeAttribute();

            thisAttribute.Min = min;
            thisAttribute.Max = max;
            if (sizeRule.message != null)
            {
                thisAttribute.Message = sizeRule.message;
            }
            AssignTagsFromString(thisAttribute, sizeRule.tags);

            return(thisAttribute);
        }
Exemple #3
0
        private static Attribute ConvertToRange(XmlNhvmRuleConverterArgs rule)
        {
            NhvmRange rangeRule = (NhvmRange)rule.schemaRule;

            long min = long.MinValue;
            long max = long.MaxValue;

            if (rangeRule.minSpecified)
            {
                min = rangeRule.min;
            }

            if (rangeRule.maxSpecified)
            {
                max = rangeRule.max;
            }

            log.Info(string.Format("Converting to Range attribute with min {0}, max {1}", min, max));
            RangeAttribute thisAttribute = new RangeAttribute();

            thisAttribute.Min = min;
            thisAttribute.Max = max;
            if (rangeRule.message != null)
            {
                thisAttribute.Message = rangeRule.message;
            }
            AssignTagsFromString(thisAttribute, rangeRule.tags);

            return(thisAttribute);
        }
Exemple #4
0
        private static Attribute ConvertToMin(XmlNhvmRuleConverterArgs rule)
        {
            NhvmMin minRule = (NhvmMin)rule.schemaRule;
            long    value   = 0;

            if (minRule.valueSpecified)
            {
                value = minRule.value;
            }

#if NETFX
            log.Info(string.Format("Converting to Min attribute with value {0}", value));
#else
            Log.Info("Converting to Min attribute with value {0}", value);
#endif
            MinAttribute thisAttribute = new MinAttribute();
            thisAttribute.Value = value;

            if (minRule.message != null)
            {
                thisAttribute.Message = minRule.message;
            }
            AssignTagsFromString(thisAttribute, minRule.tags);

            return(thisAttribute);
        }
Exemple #5
0
        private static Attribute ConvertToLength(XmlNhvmRuleConverterArgs rule)
        {
            NhvmLength lengthRule = (NhvmLength)rule.schemaRule;
            int        min        = 0;
            int        max        = int.MaxValue;

            if (lengthRule.minSpecified)
            {
                min = lengthRule.min;
            }

            if (lengthRule.maxSpecified)
            {
                max = lengthRule.max;
            }
            LengthAttribute thisAttribute = new LengthAttribute(lengthRule.min, lengthRule.max);

            log.Info(string.Format("Converting to Length attribute with min {0}, max {1}", min, max));

            if (lengthRule.message != null)
            {
                thisAttribute.Message = lengthRule.message;
            }
            AssignTagsFromString(thisAttribute, lengthRule.tags);

            return(thisAttribute);
        }
Exemple #6
0
        private static Attribute ConvertToDigits(XmlNhvmRuleConverterArgs rule)
        {
            NhvmDigits digitsRule = (NhvmDigits)rule.schemaRule;

            int fractionalDigits = 0;

            if (digitsRule.fractionalDigitsSpecified)
            {
                fractionalDigits = digitsRule.fractionalDigits;
            }

            int intDigits = digitsRule.integerDigits;

            DigitsAttribute thisAttribute = new DigitsAttribute(digitsRule.integerDigits, digitsRule.fractionalDigits);

            log.Info(string.Format("Converting to Digits attribute with integer digits {0}, fractional digits {1}", intDigits, fractionalDigits));

            if (digitsRule.message != null)
            {
                thisAttribute.Message = digitsRule.message;
            }
            AssignTagsFromString(thisAttribute, digitsRule.tags);

            return(thisAttribute);
        }
Exemple #7
0
        private static Attribute ConvertToRule(XmlNhvmRuleConverterArgs rule)
        {
            NhvmRule ruleRule = (NhvmRule)rule.schemaRule;

            string attribute = ruleRule.attribute;
            AssemblyQualifiedTypeName fullClassName =
                TypeNameParser.Parse(attribute, rule.defaultNameSpace, rule.defaultAssembly);

            System.Type type = ReflectHelper.ClassForFullName(fullClassName.ToString());
#if NETFX
            log.Info("The type found for ruleRule = " + type.FullName);
#else
            Log.Info("The type found for ruleRule = {0}", type.FullName);
#endif
            Attribute thisattribute = (Attribute)Activator.CreateInstance(type);
#if NETFX
            log.Info("Attribute found = " + thisattribute);
#else
            Log.Info("Attribute found = {0}", thisattribute);
#endif

            var tr = thisattribute as ITagableRule;
            if (tr != null)
            {
                AssignTagsFromString(tr, ruleRule.tags);
            }

            if (ruleRule.param == null)
            {
                return(thisattribute);                                    //eager return
            }
            foreach (NhvmParam parameter in ruleRule.param)
            {
                PropertyInfo propInfo = type.GetProperty(parameter.name);
                if (propInfo != null)
                {
#if NETFX
                    log.Info("propInfo value = " + parameter.value);
#else
                    Log.Info("propInfo value = {0}", parameter.value);
#endif
                    object value = propInfo.PropertyType != typeof(string)
                                                                        ? Convert.ChangeType(parameter.value, propInfo.PropertyType)
                                                                        : parameter.value;
                    propInfo.SetValue(thisattribute, value, null);
                }
                else
                {
                    throw new InvalidPropertyNameException(
                              string.Format("The custom attribute '{0}' don't have the property '{1}'; Check for typo.", type.FullName, parameter.name), parameter.name,
                              type);
                }
            }

            return(thisattribute);
        }
Exemple #8
0
        private static Attribute ConvertToNotNull(XmlNhvmRuleConverterArgs rule)
        {
            NhvmNotNull      notNullRule   = (NhvmNotNull)rule.schemaRule;
            NotNullAttribute thisAttribute = new NotNullAttribute();

            log.Info("Converting to NotNullAttribute");

            if (notNullRule.message != null)
            {
                thisAttribute.Message = notNullRule.message;
            }
            AssignTagsFromString(thisAttribute, notNullRule.tags);

            return(thisAttribute);
        }
Exemple #9
0
        private static Attribute ConvertToIBAN(XmlNhvmRuleConverterArgs rule)
        {
            NhvmIban ibanRule = (NhvmIban)rule.schemaRule;

            log.Info("Converting to IBAN attribute");
            IBANAttribute thisAttribute = new IBANAttribute();

            if (ibanRule.message != null)
            {
                thisAttribute.Message = ibanRule.message;
            }
            AssignTagsFromString(thisAttribute, ibanRule.tags);

            return(thisAttribute);
        }
Exemple #10
0
        private static Attribute ConvertToEAN(XmlNhvmRuleConverterArgs rule)
        {
            NhvmEan      eanRule       = (NhvmEan)rule.schemaRule;
            EANAttribute thisAttribute = new EANAttribute();

            log.Info("Converting to EANAttribute");

            if (eanRule.message != null)
            {
                thisAttribute.Message = eanRule.message;
            }
            AssignTagsFromString(thisAttribute, eanRule.tags);

            return(thisAttribute);
        }
Exemple #11
0
        private static Attribute ConvertToAssertFalse(XmlNhvmRuleConverterArgs rule)
        {
            NhvmAssertfalse assertTrueRule = (NhvmAssertfalse)rule.schemaRule;

            log.Info("Converting to AssertFalse attribute");
            AssertFalseAttribute thisAttribute = new AssertFalseAttribute();

            if (assertTrueRule.message != null)
            {
                thisAttribute.Message = assertTrueRule.message;
            }
            AssignTagsFromString(thisAttribute, assertTrueRule.tags);

            return(thisAttribute);
        }
Exemple #12
0
        private static Attribute ConvertToIPAddress(XmlNhvmRuleConverterArgs rule)
        {
            NhvmIpaddress ipAddressRule = (NhvmIpaddress)rule.schemaRule;

            log.Info("Converting to IP Address attribute");
            IPAddressAttribute thisAttribute = new IPAddressAttribute();

            if (ipAddressRule.message != null)
            {
                thisAttribute.Message = ipAddressRule.message;
            }
            AssignTagsFromString(thisAttribute, ipAddressRule.tags);

            return(thisAttribute);
        }
Exemple #13
0
        private static Attribute ConvertToEmail(XmlNhvmRuleConverterArgs rule)
        {
            NhvmEmail emailRule = (NhvmEmail)rule.schemaRule;

            log.Info("Converting to Email attribute");
            EmailAttribute thisAttribute = new EmailAttribute();

            if (emailRule.message != null)
            {
                thisAttribute.Message = emailRule.message;
            }
            AssignTagsFromString(thisAttribute, emailRule.tags);

            return(thisAttribute);
        }
Exemple #14
0
        private static Attribute ConvertToPast(XmlNhvmRuleConverterArgs rule)
        {
            NhvmPast pastRule = (NhvmPast)rule.schemaRule;

            log.Info("Converting to Past attribute");
            PastAttribute thisAttribute = new PastAttribute();

            if (pastRule.message != null)
            {
                thisAttribute.Message = pastRule.message;
            }
            AssignTagsFromString(thisAttribute, pastRule.tags);

            return(thisAttribute);
        }
Exemple #15
0
        private static Attribute ConvertToFuture(XmlNhvmRuleConverterArgs rule)
        {
            NhvmFuture futureRule = (NhvmFuture)rule.schemaRule;

            log.Info("Converting to future attribute");
            FutureAttribute thisAttribute = new FutureAttribute();

            if (futureRule.message != null)
            {
                thisAttribute.Message = futureRule.message;
            }
            AssignTagsFromString(thisAttribute, futureRule.tags);

            return(thisAttribute);
        }
Exemple #16
0
        private static Attribute ConvertToFileExists(XmlNhvmRuleConverterArgs rule)
        {
            NhvmFileexists fileExistsRule = (NhvmFileexists)rule.schemaRule;

            log.Info("Converting to file exists attribute");
            FileExistsAttribute thisAttribute = new FileExistsAttribute();

            if (fileExistsRule.message != null)
            {
                thisAttribute.Message = fileExistsRule.message;
            }
            AssignTagsFromString(thisAttribute, fileExistsRule.tags);

            return(thisAttribute);
        }
Exemple #17
0
        private static Attribute ConvertToCreditCardNumber(XmlNhvmRuleConverterArgs rule)
        {
            NhvmCreditcardnumber      creditCardNumberRule = (NhvmCreditcardnumber)rule.schemaRule;
            CreditCardNumberAttribute thisAttribute        = new CreditCardNumberAttribute();

            log.Info("Converting to CreditCardNumberAttribute");

            if (creditCardNumberRule.message != null)
            {
                thisAttribute.Message = creditCardNumberRule.message;
            }
            AssignTagsFromString(thisAttribute, creditCardNumberRule.tags);

            return(thisAttribute);
        }
Exemple #18
0
        private static Attribute ConvertToNotNullNotEmpty(XmlNhvmRuleConverterArgs rule)
        {
            NhvmNotnullNotempty      notNullOrEmptyRule = (NhvmNotnullNotempty)rule.schemaRule;
            NotNullNotEmptyAttribute thisAttribute      = new NotNullNotEmptyAttribute();

#if NETFX
            log.Info("Converting to NotNullNotEmptyAttribute");
#else
            Log.Info("Converting to NotNullNotEmptyAttribute");
#endif

            if (notNullOrEmptyRule.message != null)
            {
                thisAttribute.Message = notNullOrEmptyRule.message;
            }
            AssignTagsFromString(thisAttribute, notNullOrEmptyRule.tags);

            return(thisAttribute);
        }
Exemple #19
0
        private static Attribute ConvertToEnum(XmlNhvmRuleConverterArgs rule)
        {
            NhvmEnum      notNullRule   = (NhvmEnum)rule.schemaRule;
            EnumAttribute thisAttribute = new EnumAttribute();

#if NETFX
            log.Info("Converting to EnumAttribute");
#else
            Log.Info("Converting to EnumAttribute");
#endif

            if (notNullRule.message != null)
            {
                thisAttribute.Message = notNullRule.message;
            }
            AssignTagsFromString(thisAttribute, notNullRule.tags);

            return(thisAttribute);
        }
Exemple #20
0
        private static Attribute ConvertToPattern(XmlNhvmRuleConverterArgs rule)
        {
            NhvmPattern patternRule = (NhvmPattern)rule.schemaRule;

            log.Info("Converting to Pattern attribute");
            PatternAttribute thisAttribute = new PatternAttribute();

            thisAttribute.Regex = patternRule.regex;
            if (!string.IsNullOrEmpty(patternRule.regexoptions))
            {
                thisAttribute.Flags = ParsePatternFlags(patternRule.regexoptions);
            }
            if (patternRule.message != null)
            {
                thisAttribute.Message = patternRule.message;
            }
            AssignTagsFromString(thisAttribute, patternRule.tags);

            return(thisAttribute);
        }
Exemple #21
0
        private static Attribute ConvertToDecimalMin(XmlNhvmRuleConverterArgs rule)
        {
            NhvmDecimalmin minRule = (NhvmDecimalmin)rule.schemaRule;
            decimal        value   = decimal.MinValue;

            if (minRule.valueSpecified)
            {
                value = minRule.value;
            }

            log.Info(string.Format("Converting to DecimalMin attribute with value {0}", value));
            DecimalMinAttribute thisAttribute = new DecimalMinAttribute();

            thisAttribute.Value = value;

            if (minRule.message != null)
            {
                thisAttribute.Message = minRule.message;
            }
            AssignTagsFromString(thisAttribute, minRule.tags);
            return(thisAttribute);
        }
Exemple #22
0
        private static Attribute ConvertToMax(XmlNhvmRuleConverterArgs rule)
        {
            NhvmMax maxRule = (NhvmMax)rule.schemaRule;
            long    value   = long.MaxValue;

            if (maxRule.valueSpecified)
            {
                value = maxRule.value;
            }

            log.Info(string.Format("Converting to Max attribute with value {0}", value));
            MaxAttribute thisAttribute = new MaxAttribute();

            thisAttribute.Value = value;

            if (maxRule.message != null)
            {
                thisAttribute.Message = maxRule.message;
            }
            AssignTagsFromString(thisAttribute, maxRule.tags);

            return(thisAttribute);
        }
        private static Attribute ConvertToFileExists(XmlNhvmRuleConverterArgs rule)
        {
            NhvmFileexists fileExistsRule = (NhvmFileexists)rule.schemaRule;
            log.Info("Converting to file exists attribute");
            FileExistsAttribute thisAttribute = new FileExistsAttribute();
            if (fileExistsRule.message != null)
            {
                thisAttribute.Message = fileExistsRule.message;
            }
            AssignTagsFromString(thisAttribute, fileExistsRule.tags);

            return thisAttribute;
        }
        private static Attribute ConvertToFuture(XmlNhvmRuleConverterArgs rule)
        {
            NhvmFuture futureRule = (NhvmFuture)rule.schemaRule;
            log.Info("Converting to future attribute");
            FutureAttribute thisAttribute = new FutureAttribute();
            if (futureRule.message != null)
            {
                thisAttribute.Message = futureRule.message;
            }
            AssignTagsFromString(thisAttribute, futureRule.tags);

            return thisAttribute;
        }
        private static Attribute ConvertToMin(XmlNhvmRuleConverterArgs rule)
        {
            NhvmMin minRule = (NhvmMin)rule.schemaRule;
            long value = 0;

            if (minRule.valueSpecified)
                value = minRule.value;

            log.Info(string.Format("Converting to Min attribute with value {0}", value));
            MinAttribute thisAttribute = new MinAttribute();
            thisAttribute.Value = value;

            if (minRule.message != null)
            {
                thisAttribute.Message = minRule.message;
            }
            AssignTagsFromString(thisAttribute, minRule.tags);

            return thisAttribute;
        }
        private static Attribute ConvertToDigits(XmlNhvmRuleConverterArgs rule)
        {
            NhvmDigits digitsRule = (NhvmDigits)rule.schemaRule;

            int fractionalDigits = 0;

            if (digitsRule.fractionalDigitsSpecified)
                fractionalDigits = digitsRule.fractionalDigits;

            int intDigits = digitsRule.integerDigits;

            DigitsAttribute thisAttribute = new DigitsAttribute(digitsRule.integerDigits, digitsRule.fractionalDigits);
            log.Info(string.Format("Converting to Digits attribute with integer digits {0}, fractional digits {1}", intDigits, fractionalDigits));

            if (digitsRule.message != null)
            {
                thisAttribute.Message = digitsRule.message;
            }
            AssignTagsFromString(thisAttribute, digitsRule.tags);

            return thisAttribute;
        }
        private static Attribute ConvertToEAN(XmlNhvmRuleConverterArgs rule)
        {
            NhvmEan eanRule = (NhvmEan)rule.schemaRule;
            EANAttribute thisAttribute = new EANAttribute();
            log.Info("Converting to EANAttribute");

            if (eanRule.message != null)
            {
                thisAttribute.Message = eanRule.message;
            }
            AssignTagsFromString(thisAttribute, eanRule.tags);

            return thisAttribute;
        }
        private static Attribute ConvertToIBAN(XmlNhvmRuleConverterArgs rule)
        {
            NhvmIban ibanRule = (NhvmIban)rule.schemaRule;
            log.Info("Converting to IBAN attribute");
            IBANAttribute thisAttribute = new IBANAttribute();

            if (ibanRule.message != null)
            {
                thisAttribute.Message = ibanRule.message;
            }
            AssignTagsFromString(thisAttribute, ibanRule.tags);

            return thisAttribute;
        }
        private static Attribute ConvertToNotNull(XmlNhvmRuleConverterArgs rule)
        {
            NhvmNotNull notNullRule = (NhvmNotNull)rule.schemaRule;
            NotNullAttribute thisAttribute = new NotNullAttribute();
            log.Info("Converting to NotNullAttribute");

            if (notNullRule.message != null)
            {
                thisAttribute.Message = notNullRule.message;
            }

            return thisAttribute;
        }
        private static Attribute ConvertToRange(XmlNhvmRuleConverterArgs rule)
        {
            NhvmRange rangeRule = (NhvmRange)rule.schemaRule;

            long min = long.MinValue;
            long max = long.MaxValue;

            if (rangeRule.minSpecified)
                min = rangeRule.min;

            if (rangeRule.maxSpecified)
                max = rangeRule.max;

            log.Info(string.Format("Converting to Range attribute with min {0}, max {1}", min, max));
            RangeAttribute thisAttribute = new RangeAttribute();
            thisAttribute.Min = min;
            thisAttribute.Max = max;
            if (rangeRule.message != null)
            {
                thisAttribute.Message = rangeRule.message;
            }
            AssignTagsFromString(thisAttribute, rangeRule.tags);

            return thisAttribute;
        }
        private static Attribute ConvertToMax(XmlNhvmRuleConverterArgs rule)
        {
            NhvmMax maxRule = (NhvmMax)rule.schemaRule;
            long value = long.MaxValue;

            if (maxRule.valueSpecified)
                value = maxRule.value;

            log.Info(string.Format("Converting to Max attribute with value {0}", value));
            MaxAttribute thisAttribute = new MaxAttribute();
            thisAttribute.Value = value;

            if (maxRule.message != null)
            {
                thisAttribute.Message = maxRule.message;
            }

            return thisAttribute;
        }
        private static Attribute ConvertToIPAddress(XmlNhvmRuleConverterArgs rule)
        {
            NhvmIpaddress ipAddressRule = (NhvmIpaddress)rule.schemaRule;
            log.Info("Converting to IP Address attribute");
            IPAddressAttribute thisAttribute = new IPAddressAttribute();

            if (ipAddressRule.message != null)
            {
                thisAttribute.Message = ipAddressRule.message;
            }
            AssignTagsFromString(thisAttribute, ipAddressRule.tags);

            return thisAttribute;
        }
        private static Attribute ConvertToNotNullNotEmpty(XmlNhvmRuleConverterArgs rule)
        {
            NhvmNotnullNotempty notNullOrEmptyRule = (NhvmNotnullNotempty)rule.schemaRule;
            NotNullNotEmptyAttribute thisAttribute = new NotNullNotEmptyAttribute();
            log.Info("Converting to NotEmptyAttribute");

            if (notNullOrEmptyRule.message != null)
            {
                thisAttribute.Message = notNullOrEmptyRule.message;
            }
            AssignTagsFromString(thisAttribute, notNullOrEmptyRule.tags);

            return thisAttribute;
        }
        private static Attribute ConvertToEmail(XmlNhvmRuleConverterArgs rule)
        {
            NhvmEmail emailRule = (NhvmEmail)rule.schemaRule;
            log.Info("Converting to Email attribute");
            EmailAttribute thisAttribute = new EmailAttribute();
            if (emailRule.message != null)
            {
                thisAttribute.Message = emailRule.message;
            }
            AssignTagsFromString(thisAttribute, emailRule.tags);

            return thisAttribute;
        }
        private static Attribute ConvertToDecimalMax(XmlNhvmRuleConverterArgs rule)
        {
            NhvmDecimalmax maxRule = (NhvmDecimalmax)rule.schemaRule;
            decimal value = decimal.MaxValue;

            if (maxRule.valueSpecified)
                value = maxRule.value;

            log.Info(string.Format("Converting to DecimalMax attribute with value {0}", value));
            DecimalMaxAttribute thisAttribute = new DecimalMaxAttribute();
            thisAttribute.Value = value;

            if (maxRule.message != null)
            {
                thisAttribute.Message = maxRule.message;
            }
            AssignTagsFromString(thisAttribute, maxRule.tags);
            return thisAttribute;
        }
        private static Attribute ConvertToAssertTrue(XmlNhvmRuleConverterArgs rule)
        {
            NhvmAsserttrue assertTrueRule = (NhvmAsserttrue)rule.schemaRule;

            log.Info("Converting to AssertTrue attribute");
            AssertTrueAttribute thisAttribute = new AssertTrueAttribute();
            if (assertTrueRule.message != null)
            {
                thisAttribute.Message = assertTrueRule.message;
            }
            AssignTagsFromString(thisAttribute, assertTrueRule.tags);

            return thisAttribute;
        }
Exemple #37
0
        private static Attribute ConvertToValid(XmlNhvmRuleConverterArgs rule)
        {
            ValidAttribute validAttribute = new ValidAttribute();

            return(validAttribute);
        }
        private static Attribute ConvertToRule(XmlNhvmRuleConverterArgs rule)
        {
            NhvmRule ruleRule = (NhvmRule)rule.schemaRule;

            string attribute = ruleRule.attribute;
            AssemblyQualifiedTypeName fullClassName =
                TypeNameParser.Parse(attribute, rule.defaultNameSpace, rule.defaultAssembly);

            System.Type type = ReflectHelper.ClassForFullName(fullClassName.ToString());
            log.Info("The type found for ruleRule = " + type.FullName);
            Attribute thisattribute = (Attribute)Activator.CreateInstance(type);
            log.Info("Attribute found = " + thisattribute);

            var tr = thisattribute as ITagableRule;
            if (tr != null)
            {
                AssignTagsFromString(tr, ruleRule.tags);
            }

            if (ruleRule.param == null) return thisattribute; //eager return

            foreach (NhvmParam parameter in ruleRule.param)
            {
                PropertyInfo propInfo = type.GetProperty(parameter.name);
                if (propInfo != null)
                {
                    log.Info("propInfo value = " + parameter.value);
                    object value = propInfo.PropertyType != typeof(string)
                                    ? Convert.ChangeType(parameter.value, propInfo.PropertyType)
                                    : parameter.value;
                    propInfo.SetValue(thisattribute, value, null);
                }
                else
                {
                    throw new InvalidPropertyNameException(
                        string.Format("The custom attribute '{0}' don't have the property '{1}'; Check for typo.", type.FullName, parameter.name), parameter.name,
                        type);
                }
            }

            return thisattribute;
        }
        private static Attribute ConvertToLength(XmlNhvmRuleConverterArgs rule)
        {
            NhvmLength lengthRule = (NhvmLength)rule.schemaRule;
            int min = 0;
            int max = int.MaxValue;

            if (lengthRule.minSpecified)
                min = lengthRule.min;

            if (lengthRule.maxSpecified)
                max = lengthRule.max;
            LengthAttribute thisAttribute = new LengthAttribute(lengthRule.min, lengthRule.max);
            log.Info(string.Format("Converting to Length attribute with min {0}, max {1}", min, max));

            if (lengthRule.message != null)
            {
                thisAttribute.Message = lengthRule.message;
            }
            AssignTagsFromString(thisAttribute, lengthRule.tags);

            return thisAttribute;
        }
        private static Attribute ConvertToSize(XmlNhvmRuleConverterArgs rule)
        {
            NhvmSize sizeRule = (NhvmSize)rule.schemaRule;
            int min = int.MinValue;
            int max = int.MaxValue;

            if (sizeRule.minSpecified)
                min = sizeRule.min;

            if (sizeRule.maxSpecified)
                max = sizeRule.max;

            log.Info(string.Format("Converting to Size attribute with min {0}, max {1}", min, max));
            SizeAttribute thisAttribute = new SizeAttribute();
            thisAttribute.Min = min;
            thisAttribute.Max = max;
            if (sizeRule.message != null)
            {
                thisAttribute.Message = sizeRule.message;
            }
            AssignTagsFromString(thisAttribute, sizeRule.tags);

            return thisAttribute;
        }
 private static Attribute ConvertToValid(XmlNhvmRuleConverterArgs rule)
 {
     ValidAttribute validAttribute = new ValidAttribute();
     return validAttribute;
 }
        private static Attribute ConvertToPast(XmlNhvmRuleConverterArgs rule)
        {
            NhvmPast pastRule = (NhvmPast)rule.schemaRule;
            log.Info("Converting to Past attribute");
            PastAttribute thisAttribute = new PastAttribute();
            if (pastRule.message != null)
            {
                thisAttribute.Message = pastRule.message;
            }
            AssignTagsFromString(thisAttribute, pastRule.tags);

            return thisAttribute;
        }
        private static Attribute ConvertToCreditCardNumber(XmlNhvmRuleConverterArgs rule)
        {
            NhvmCreditcardnumber creditCardNumberRule = (NhvmCreditcardnumber)rule.schemaRule;
            CreditCardNumberAttribute thisAttribute = new CreditCardNumberAttribute();
            log.Info("Converting to CreditCardNumberAttribute");

            if (creditCardNumberRule.message != null)
            {
                thisAttribute.Message = creditCardNumberRule.message;
            }
            AssignTagsFromString(thisAttribute, creditCardNumberRule.tags);

            return thisAttribute;
        }
        private static Attribute ConvertToPattern(XmlNhvmRuleConverterArgs rule)
        {
            NhvmPattern patternRule = (NhvmPattern)rule.schemaRule;

            log.Info("Converting to Pattern attribute");
            PatternAttribute thisAttribute = new PatternAttribute();
            thisAttribute.Regex = patternRule.regex;
            if (!string.IsNullOrEmpty(patternRule.regexoptions))
            {
                thisAttribute.Flags = ParsePatternFlags(patternRule.regexoptions);
            }
            if (patternRule.message != null)
            {
                thisAttribute.Message = patternRule.message;
            }
            AssignTagsFromString(thisAttribute, patternRule.tags);

            return thisAttribute;
        }
        private static Attribute ConvertToAssertFalse(XmlNhvmRuleConverterArgs rule)
        {
            NhvmAssertfalse assertTrueRule = (NhvmAssertfalse)rule.schemaRule;

            log.Info("Converting to AssertFalse attribute");
            AssertFalseAttribute thisAttribute = new AssertFalseAttribute();
            if (assertTrueRule.message != null)
            {
                thisAttribute.Message = assertTrueRule.message;
            }

            return thisAttribute;
        }