internal MetaType(MetaConstructor c) : this(c.Type) { Type type = c.Type; if (Nullable.GetUnderlyingType(type) != null) { type = Nullable.GetUnderlyingType(type); this.IsNullable = true; } this.Parameters = new List <MetaType>(); List <MetaAttribute> attributes = new List <MetaAttribute>(); this.Attributes = attributes; if (type.BaseType != null) { this.BaseType = MetaType.FromConstructor(c, type.BaseType); } if (this.CoreType == CoreType.Collection) { this.CollectionType = MetaType.FromConstructor(c, type.GetCollectionType()); } foreach (Type g in type.GetGenericArguments()) { this.Parameters.Add(MetaType.FromConstructor(c, g)); } if (c.Settings.AttributeIncludeSettings != AttributeIncludeSetting.None) { foreach (AttributeInstance a in TypeCache.GetCustomAttributes(type)) { if (c.Settings.ShouldAddAttribute(a.Instance.GetType())) { attributes.Add(MetaAttribute.FromConstructor(c, a, type)); } } } this.Properties = new List <MetaProperty>(); if (this.CoreType != CoreType.Value) { foreach (PropertyInfo thisProperty in c.GetProperties()) { if (c.Validate(thisProperty)) { this.Properties.Add(MetaProperty.FromConstructor(c, thisProperty)); } } } }
internal MetaProperty(MetaConstructor c) : base() { this.Name = c.PropertyInfo.Name; this.Type = MetaType.FromConstructor(c, c.PropertyInfo.PropertyType); this.DeclaringType = MetaType.FromConstructor(c, c.PropertyInfo.DeclaringType); List <MetaAttribute> attributes = new List <MetaAttribute>(); this.Attributes = attributes; if (c.Settings.AttributeIncludeSettings != AttributeIncludeSetting.None) { foreach (AttributeInstance a in TypeCache.GetCustomAttributes(c.PropertyInfo)) { if (c.Settings.ShouldAddAttribute(a.Instance.GetType())) { attributes.Add(MetaAttribute.FromConstructor(c, a, c.PropertyInfo)); } } } }