private SqlExpression ApplyNewTypeMapping(SqlExpression sqlExpression, RelationalTypeMapping typeMapping) { return(sqlExpression switch { MySqlComplexFunctionArgumentExpression e => ApplyTypeMappingOnComplexFunctionArgument(e), MySqlCollateExpression e => ApplyTypeMappingOnCollate(e), MySqlRegexpExpression e => ApplyTypeMappingOnRegexp(e), MySqlBinaryExpression e => ApplyTypeMappingOnMySqlBinary(e, typeMapping), MySqlMatchExpression e => ApplyTypeMappingOnMatch(e), MySqlJsonArrayIndexExpression e => e.ApplyTypeMapping(typeMapping), _ => base.ApplyTypeMapping(sqlExpression, typeMapping) });
public Expression VisitMySqlComplexFunctionArgumentExpression(MySqlComplexFunctionArgumentExpression mySqlComplexFunctionArgumentExpression) { Check.NotNull(mySqlComplexFunctionArgumentExpression, nameof(mySqlComplexFunctionArgumentExpression)); var first = true; foreach (var argument in mySqlComplexFunctionArgumentExpression.ArgumentParts) { if (first) { first = false; } else { Sql.Append(" "); } Visit(argument); } return(mySqlComplexFunctionArgumentExpression); }
private MySqlComplexFunctionArgumentExpression ApplyTypeMappingOnComplexFunctionArgument(MySqlComplexFunctionArgumentExpression complexFunctionArgumentExpression) { var inferredTypeMapping = ExpressionExtensions.InferTypeMapping(complexFunctionArgumentExpression.ArgumentParts.ToArray()) ?? _typeMappingSource.FindMapping(complexFunctionArgumentExpression.Type); return(new MySqlComplexFunctionArgumentExpression( complexFunctionArgumentExpression.ArgumentParts, complexFunctionArgumentExpression.Type, inferredTypeMapping ?? complexFunctionArgumentExpression.TypeMapping)); }