Exemplo n.º 1
0
 /// <summary>
 /// Returns the subtype of the EntityType in the current itemCollection
 /// </summary>
 public IEnumerable<EntityType> GetSubtypesOf(EntityType type, ItemCollection itemCollection, bool includeAbstractTypes)
 {
     if (type != null)
     {
         IEnumerable<EntityType> typesInCollection = itemCollection.GetItems<EntityType>();
         foreach (EntityType typeInCollection in typesInCollection)
         {
             if (type.Equals(typeInCollection) == false && this.IsSubtypeOf(typeInCollection, type))
             {
                 if (includeAbstractTypes || !typeInCollection.Abstract)
                 {
                     yield return typeInCollection;
                 }
             }
         }
     }
 }
        private static IEnumerable<EntityType> GetTypeAndSubtypesOf(EntityType entityType, EdmItemCollection itemCollection)
        {
            // Always include the specified type, even if it's abstract
            yield return entityType;

            // Get the subtypes of the type from the item collection
            IEnumerable<EntityType> entityTypesInCollection = itemCollection.OfType<EntityType>();
            foreach (EntityType typeInCollection in entityTypesInCollection)
            {
                if (entityType.Equals(typeInCollection) == false && IsStrictSubtypeOf(typeInCollection, entityType))
                {
                    yield return typeInCollection;
                }
            }

            yield break;
        }