Exemplo n.º 1
0
        private static void GetIntegerConstraints(ADSchemaAttributeObject schemaObject, ADPropertyDefinition propDef, List <PropertyDefinitionConstraint> constraints)
        {
            bool isUnlimited;
            bool isNullable;
            Type typeInformation = ADSchemaDataProvider.GetTypeInformation(propDef.Type, out isUnlimited, out isNullable);

            if (typeInformation == typeof(int))
            {
                int minValue = schemaObject.RangeLower ?? int.MinValue;
                int maxValue = schemaObject.RangeUpper ?? int.MaxValue;
                constraints.Add(ADSchemaDataProvider.GetRangedConstraint <int>(minValue, maxValue, isUnlimited, isNullable));
                return;
            }
            if (typeInformation == typeof(ByteQuantifiedSize))
            {
                IFormatProvider formatProvider           = propDef.FormatProvider;
                ByteQuantifiedSize.Quantifier quantifier = (formatProvider != null) ? ((ByteQuantifiedSize.Quantifier)formatProvider.GetFormat(typeof(ByteQuantifiedSize.Quantifier))) : ByteQuantifiedSize.Quantifier.None;
                ulong number                 = (ulong)((long)(schemaObject.RangeLower ?? 0));
                int?  rangeUpper             = schemaObject.RangeUpper;
                ulong number2                = ((rangeUpper != null) ? new ulong?((ulong)((long)rangeUpper.GetValueOrDefault())) : null) ?? Math.Min((ulong)((ByteQuantifiedSize.Quantifier) 18446744073709551615UL / quantifier), 2147483647UL);
                ByteQuantifiedSize minValue2 = ByteQuantifiedSize.FromSpecifiedUnit(number, quantifier);
                ByteQuantifiedSize maxValue2 = ByteQuantifiedSize.FromSpecifiedUnit(number2, quantifier);
                constraints.Add(ADSchemaDataProvider.GetRangedConstraint <ByteQuantifiedSize>(minValue2, maxValue2, isUnlimited, isNullable));
                return;
            }
            ExTraceGlobals.SchemaInitializationTracer.TraceDebug <DataSyntax, ADPropertyDefinition>(0L, "Unsupported property type '{1}' for data syntax '{0}'.", schemaObject.DataSyntax, propDef);
        }
Exemplo n.º 2
0
        private static bool IsKnownType(Type type)
        {
            bool flag;
            bool flag2;
            Type typeInformation = ADSchemaDataProvider.GetTypeInformation(type, out flag, out flag2);

            return(typeof(string) == typeInformation || typeof(int) == typeInformation || typeof(long) == typeInformation || typeof(ByteQuantifiedSize) == typeInformation || typeof(SmtpDomain) == typeInformation || typeof(SmtpAddress) == typeInformation || typeof(ProtocolConnectionSettings) == typeInformation || typeof(SmtpDomainWithSubdomains) == typeInformation || typeof(RoleEntry) == typeInformation || typeof(ProxyAddressTemplate) == typeInformation || typeof(UncFileSharePath) == typeInformation || typeof(NonRootLocalLongFullPath) == typeInformation || typeof(ProxyAddress) == typeInformation || typeof(byte[]) == typeInformation);
        }