Example #1
0
 private static bool TryGetCommonType(
     EdmType edmType1,
     EdmType edmType2,
     out EdmType commonEdmType)
 {
     if (edmType2 == edmType1)
     {
         commonEdmType = edmType1;
         return(true);
     }
     if (Helper.IsPrimitiveType(edmType1) && Helper.IsPrimitiveType(edmType2))
     {
         return(TypeSemantics.TryGetCommonType((PrimitiveType)edmType1, (PrimitiveType)edmType2, out commonEdmType));
     }
     if (Helper.IsCollectionType((GlobalItem)edmType1) && Helper.IsCollectionType((GlobalItem)edmType2))
     {
         return(TypeSemantics.TryGetCommonType((CollectionType)edmType1, (CollectionType)edmType2, out commonEdmType));
     }
     if (Helper.IsEntityTypeBase(edmType1) && Helper.IsEntityTypeBase(edmType2))
     {
         return(TypeSemantics.TryGetCommonBaseType(edmType1, edmType2, out commonEdmType));
     }
     if (Helper.IsRefType((GlobalItem)edmType1) && Helper.IsRefType((GlobalItem)edmType2))
     {
         return(TypeSemantics.TryGetCommonType((RefType)edmType1, (RefType)edmType2, out commonEdmType));
     }
     if (Helper.IsRowType((GlobalItem)edmType1) && Helper.IsRowType((GlobalItem)edmType2))
     {
         return(TypeSemantics.TryGetCommonType((RowType)edmType1, (RowType)edmType2, out commonEdmType));
     }
     commonEdmType = (EdmType)null;
     return(false);
 }