private static void ReportIncompatibleCommonType( ErrorContext errCtx, TypeUsage rootLeftType, TypeUsage rootRightType, TypeUsage leftType, TypeUsage rightType) { TypeUsage commonType = (TypeUsage)null; bool flag = rootLeftType == leftType; string empty = string.Empty; if (leftType.EdmType.BuiltInTypeKind != rightType.EdmType.BuiltInTypeKind) { throw EntitySqlException.Create(errCtx, Strings.TypeKindMismatch((object)CqlErrorHelper.GetReadableTypeKind(leftType), (object)CqlErrorHelper.GetReadableTypeName(leftType), (object)CqlErrorHelper.GetReadableTypeKind(rightType), (object)CqlErrorHelper.GetReadableTypeName(rightType)), (Exception)null); } switch (leftType.EdmType.BuiltInTypeKind) { case BuiltInTypeKind.CollectionType: case BuiltInTypeKind.RefType: CqlErrorHelper.ReportIncompatibleCommonType(errCtx, rootLeftType, rootRightType, TypeHelpers.GetElementTypeUsage(leftType), TypeHelpers.GetElementTypeUsage(rightType)); break; case BuiltInTypeKind.ComplexType: ComplexType edmType1 = (ComplexType)leftType.EdmType; ComplexType edmType2 = (ComplexType)rightType.EdmType; if (edmType1.Members.Count != edmType2.Members.Count) { string errorMessage = !flag?Strings.InvalidComplexType((object)CqlErrorHelper.GetReadableTypeName((EdmType)edmType1), (object)CqlErrorHelper.GetReadableTypeName(rootLeftType), (object)CqlErrorHelper.GetReadableTypeName((EdmType)edmType2), (object)CqlErrorHelper.GetReadableTypeName(rootRightType)) : Strings.InvalidRootComplexType((object)CqlErrorHelper.GetReadableTypeName((EdmType)edmType1), (object)CqlErrorHelper.GetReadableTypeName((EdmType)edmType2)); throw EntitySqlException.Create(errCtx, errorMessage, (Exception)null); } for (int index = 0; index < edmType1.Members.Count; ++index) { CqlErrorHelper.ReportIncompatibleCommonType(errCtx, rootLeftType, rootRightType, edmType1.Members[index].TypeUsage, edmType2.Members[index].TypeUsage); } break; case BuiltInTypeKind.EntityType: if (TypeSemantics.TryGetCommonType(leftType, rightType, out commonType)) { break; } string errorMessage1 = !flag?Strings.InvalidEntityTypeArgument((object)CqlErrorHelper.GetReadableTypeName(leftType), (object)CqlErrorHelper.GetReadableTypeName(rootLeftType), (object)CqlErrorHelper.GetReadableTypeName(rightType), (object)CqlErrorHelper.GetReadableTypeName(rootRightType)) : Strings.InvalidEntityRootTypeArgument((object)CqlErrorHelper.GetReadableTypeName(leftType), (object)CqlErrorHelper.GetReadableTypeName(rightType)); throw EntitySqlException.Create(errCtx, errorMessage1, (Exception)null); case BuiltInTypeKind.RowType: RowType edmType3 = (RowType)leftType.EdmType; RowType edmType4 = (RowType)rightType.EdmType; if (edmType3.Members.Count != edmType4.Members.Count) { string errorMessage2 = !flag?Strings.InvalidRowType((object)CqlErrorHelper.GetReadableTypeName((EdmType)edmType3), (object)CqlErrorHelper.GetReadableTypeName(rootLeftType), (object)CqlErrorHelper.GetReadableTypeName((EdmType)edmType4), (object)CqlErrorHelper.GetReadableTypeName(rootRightType)) : Strings.InvalidRootRowType((object)CqlErrorHelper.GetReadableTypeName((EdmType)edmType3), (object)CqlErrorHelper.GetReadableTypeName((EdmType)edmType4)); throw EntitySqlException.Create(errCtx, errorMessage2, (Exception)null); } for (int index = 0; index < edmType3.Members.Count; ++index) { CqlErrorHelper.ReportIncompatibleCommonType(errCtx, rootLeftType, rootRightType, edmType3.Members[index].TypeUsage, edmType4.Members[index].TypeUsage); } break; default: if (TypeSemantics.TryGetCommonType(leftType, rightType, out commonType)) { break; } string errorMessage3 = !flag?Strings.InvalidPlaceholderTypeArgument((object)CqlErrorHelper.GetReadableTypeKind(leftType), (object)CqlErrorHelper.GetReadableTypeName(leftType), (object)CqlErrorHelper.GetReadableTypeName(rootLeftType), (object)CqlErrorHelper.GetReadableTypeKind(rightType), (object)CqlErrorHelper.GetReadableTypeName(rightType), (object)CqlErrorHelper.GetReadableTypeName(rootRightType)) : Strings.InvalidPlaceholderRootTypeArgument((object)CqlErrorHelper.GetReadableTypeKind(leftType), (object)CqlErrorHelper.GetReadableTypeName(leftType), (object)CqlErrorHelper.GetReadableTypeKind(rightType), (object)CqlErrorHelper.GetReadableTypeName(rightType)); throw EntitySqlException.Create(errCtx, errorMessage3, (Exception)null); } }
private static string GetReadableTypeName(TypeUsage type) { return(CqlErrorHelper.GetReadableTypeName(type.EdmType)); }