Add support for compare function to SqlFormatter

develop
Matija Koželj 2 years ago
parent 16b430ef2f
commit ed7e8f411a

@ -6,6 +6,7 @@ using System.Text;
using Connected.Expressions.Languages; using Connected.Expressions.Languages;
using Connected.Expressions.Translation; using Connected.Expressions.Translation;
using Connected.Expressions.Visitors; using Connected.Expressions.Visitors;
using Connected.Interop;
namespace Connected.Expressions.Formatters; namespace Connected.Expressions.Formatters;
@ -250,6 +251,15 @@ public class SqlFormatter : DatabaseVisitor
return m; 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"); throw new NotSupportedException($"The method '{m.Method.Name}' is not supported");
} }

Loading…
Cancel
Save