private ObjectBaseValidator(TypeOverrideDescriptor forType)
        {
            Properties = Array.AsReadOnly(forType.OverridableProperties
                .Union(forType.SettableProperties)
                .Union(forType.OverridableInterfaces.SelectMany(i => i.OverridableProperties))
                .Where(p => !p.GetIndexParameters().Any()).ToArray());

            Events = Array.AsReadOnly(forType.AllEvents.ToArray());

            Indexes = Array.AsReadOnly(forType.OverridableProperties
                .Union(forType.SettableProperties)
                .Union(forType.OverridableInterfaces.SelectMany(i => i.OverridableProperties))
                .Where(p => p.GetIndexParameters().Any()).ToArray());

            Fields = Array.AsReadOnly(forType.SettableFields.ToArray());

            Methods = Array.AsReadOnly(forType.OverridableMethods
                .Union(forType.OverridableInterfaces.SelectMany(i => i.OverridableMethods)).ToArray());
        }
Exemple #2
0
        public static TypeOverrideDescriptor Create(Type forType)
        {
            if (!DxSettings.GlobalSettings.CacheTypeCheckers)
                return new TypeOverrideDescriptor(forType);

            TypeOverrideDescriptor value;
            if (!Cache.TryGetValue(forType, out value))
                Cache.AddOrUpdate(forType,
                    value = new TypeOverrideDescriptor(forType),
                    (a, b) => value);

            return value;
        }