protected bool IsMappedFor(ICollection<System.Type> explicitMappedEntities, System.Type type) { bool isExplicitMapped = explicitMappedEntities.Contains(type); bool isDerived = false; if (!isExplicitMapped) { isDerived = type.GetBaseTypes().Any(explicitMappedEntities.Contains); if (isDerived) { explicitMappedEntities.Add(type); } } return isExplicitMapped || isDerived; }
public virtual bool IsEntity(System.Type type) { return rootEntities.Contains(type) || type.GetBaseTypes().Any(t => rootEntities.Contains(t)) || HasDelayedEntityRegistration(type); }
protected System.Type GetRootEntityOrNull(System.Type entityType) { if (entityType == null) { return null; } if (IsRootEntity(entityType)) { return entityType; } return entityType.GetBaseTypes().SingleOrDefault(IsRootEntity); }
protected IEnumerable<System.Type> GetRootEntitiesOf(System.Type entityType) { if (entityType == null) { yield break; } if(IsRootEntity(entityType)) { yield return entityType; } foreach (var type in entityType.GetBaseTypes().Where(IsRootEntity)) { yield return type; } }