Exemplo n.º 1
0
        public static System.Data.Entity.Core.Metadata.Edm.EntityType GetEntityType(
            this EdmModel model,
            Type clrType)
        {
            IList <System.Data.Entity.Core.Metadata.Edm.EntityType> entityTypeList = model.EntityTypes as IList <System.Data.Entity.Core.Metadata.Edm.EntityType> ?? (IList <System.Data.Entity.Core.Metadata.Edm.EntityType>)model.EntityTypes.ToList <System.Data.Entity.Core.Metadata.Edm.EntityType>();

            for (int index = 0; index < entityTypeList.Count; ++index)
            {
                System.Data.Entity.Core.Metadata.Edm.EntityType entityType = entityTypeList[index];
                if (EntityTypeExtensions.GetClrType(entityType) == clrType)
                {
                    return(entityType);
                }
            }
            return((System.Data.Entity.Core.Metadata.Edm.EntityType)null);
        }
Exemplo n.º 2
0
        public static Type GetClrType(this EdmType item)
        {
            EntityType entityType = item as EntityType;

            if (entityType != null)
            {
                return(EntityTypeExtensions.GetClrType(entityType));
            }
            EnumType enumType = item as EnumType;

            if (enumType != null)
            {
                return(EnumTypeExtensions.GetClrType(enumType));
            }
            ComplexType complexType = item as ComplexType;

            if (complexType != null)
            {
                return(ComplexTypeExtensions.GetClrType(complexType));
            }
            return((Type)null);
        }
Exemplo n.º 3
0
 public static IEnumerable <Type> GetClrTypes(this EdmModel model)
 {
     return(model.EntityTypes.Select <System.Data.Entity.Core.Metadata.Edm.EntityType, Type>((Func <System.Data.Entity.Core.Metadata.Edm.EntityType, Type>)(e => EntityTypeExtensions.GetClrType(e))).Union <Type>(model.ComplexTypes.Select <ComplexType, Type>((Func <ComplexType, Type>)(ct => ComplexTypeExtensions.GetClrType(ct)))));
 }