protected bool HasMultipleCollectionOf(Type collectionOwner, Type elementType, ref int collectionCount) { foreach (var propertyType in collectionOwner.GetProperties(PublicPropertiesOfClassHierarchy).Where(p => DomainInspector.IsPersistentProperty(p)).Select(p => p.PropertyType)) { if (!propertyType.Equals(elementType) && DomainInspector.IsComponent(propertyType)) { if (HasMultipleCollectionOf(propertyType, elementType, ref collectionCount)) { return(true); } } else { var propertyElementType = propertyType.DetermineCollectionElementOrDictionaryValueType(); if (elementType.Equals(propertyElementType)) { collectionCount++; } } if (collectionCount > 1) { return(true); } } return(false); }
protected virtual bool KeyIsElement(Type memberType, MemberInfo subject) { var mapKey = memberType.DetermineDictionaryKeyType(); return(!DomainInspector.IsManyToMany(subject.ReflectedType, mapKey) && !DomainInspector.IsComponent(mapKey)); }