protected override void OnCreateXType <T>(XType <T> xType) { Type type = typeof(T); if (type.IsArray || XDefaultTypes.IsDefaultType(type)) { return; } // Determine correct access level MemberAccess pptyAccess = GetPropertyAccess <T>(); // Scan for properties that meet the get-accessor requirements List <PropertyInfo> candidateProperties = new List <PropertyInfo>(); foreach (PropertyInfo pi in type.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance) .Where(x => x.GetIndexParameters().Length == 0 && (x.GetMethod.IsPublic || (x.GetMethod.IsFamilyOrAssembly && pptyAccess.HasFlag(MemberAccess.ProtectedInternalGet)) || (x.GetMethod.IsAssembly && pptyAccess.HasFlag(MemberAccess.InternalGet)) || (x.GetMethod.IsFamily && pptyAccess.HasFlag(MemberAccess.ProtectedGet)) || (x.GetMethod.IsFamilyAndAssembly && pptyAccess.HasFlag(MemberAccess.PrivateProtectedGet)) || (x.GetMethod.IsPrivate && pptyAccess.HasFlag(MemberAccess.PrivateGet))))) { Type declaring = pi.DeclaringType; if ((declaring.IsGenericType && ignoredProperties.TryGetValue(declaring.GetGenericTypeDefinition(), out IEnumerable <string> ignored) && ignored.Contains(pi.Name)) || (!declaring.IsGenericType && ignoredProperties.TryGetValue(declaring, out ignored) && ignored.Contains(pi.Name))) { continue; } candidateProperties.Add(pi); } // Register xType.Register(new XProperties <T>(xType, candidateProperties)); }
internal bool ConstructorEligible <T>(XType <T> xType) { Type type = typeof(T); return(type.CanCreateInstances() && !type.IsValueType && !type.IsArray && !XDefaultTypes.IsDefaultType(type) && xType.Component <XTexter <T> >() == null && xType.Component <XBuilderComponent <T> >() == null); }