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); }
private bool IsUnidirectionalOneToMany(Type from, Type to) { return(DomainInspector.IsOneToMany(from, to) && to.GetFirstPropertyOfType(from, p => DomainInspector.IsPersistentProperty(p)) == null); }