From ed7e8f411a494fd1c8e16f0374805dd8300dcb47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20Ko=C5=BEelj?= Date: Wed, 25 Jan 2023 16:28:15 +0100 Subject: [PATCH] Add support for compare function to SqlFormatter --- src/Connected.Expressions/Formatters/SqlFormatter.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Connected.Expressions/Formatters/SqlFormatter.cs b/src/Connected.Expressions/Formatters/SqlFormatter.cs index 11abea5..cca0129 100644 --- a/src/Connected.Expressions/Formatters/SqlFormatter.cs +++ b/src/Connected.Expressions/Formatters/SqlFormatter.cs @@ -6,6 +6,7 @@ using System.Text; using Connected.Expressions.Languages; using Connected.Expressions.Translation; using Connected.Expressions.Visitors; +using Connected.Interop; namespace Connected.Expressions.Formatters; @@ -250,6 +251,15 @@ public class SqlFormatter : DatabaseVisitor return m; } } + else if (string.Equals(m.Method.Name, "Compare", StringComparison.Ordinal) && m.Method.DeclaringType == typeof(TypeComparer)) + { + Write(OpenBracket); + Visit(m.Arguments[0]); + Write(" = "); + Visit(m.Arguments[1]); + Write(CloseBracket); + return m; + } throw new NotSupportedException($"The method '{m.Method.Name}' is not supported"); }