public static IEdmTypeReference ToEdmTypeReference(this IEdmType edmType, bool isNullable) { Contract.Assert(edmType != null); switch (edmType.TypeKind) { case EdmTypeKind.Collection: return(new EdmCollectionTypeReference(edmType as IEdmCollectionType)); case EdmTypeKind.Complex: return(new EdmComplexTypeReference(edmType as IEdmComplexType, isNullable)); case EdmTypeKind.Entity: return(new EdmEntityTypeReference(edmType as IEdmEntityType, isNullable)); case EdmTypeKind.EntityReference: return(new EdmEntityReferenceTypeReference(edmType as IEdmEntityReferenceType, isNullable)); case EdmTypeKind.Enum: return(new EdmEnumTypeReference(edmType as IEdmEnumType, isNullable)); case EdmTypeKind.Primitive: return(_coreModel.GetPrimitive((edmType as IEdmPrimitiveType).PrimitiveKind, isNullable)); case EdmTypeKind.Untyped: return(_coreModel.GetUntyped()); // ignore isNullable, it's always "true"? default: throw Error.NotSupported(SRResources.EdmTypeNotSupported, edmType.ToTraceString()); } }