public override TSqlQuery Compile(ClauseCompilationContext context) { if (Value == null) { if (!NullValueComparisonOperators.Contains(Operation)) { throw new InvalidOperationException($"Invalid operation for null value. Should be one of {string.Join(", ", NullValueComparisonOperators)}"); } return(GetNullValueQuery()); } Dictionary <string, object> parameters = null; string valueString; if (Value is TSqlStatement tsqlStatement) { valueString = tsqlStatement.GetDescription(); } else { string parameterName = SqlBuilderHelper.GetUniqueParameterName(SqlBuilderHelper.ComposeParameterName(Field.TableName, Field.FieldName), context); context.ParameterNames.Add(parameterName); parameters = new Dictionary <string, object> { { parameterName, Value } }; valueString = SqlBuilderHelper.PrepareParameterName(parameterName); } return(new TSqlQuery( $"{Field.GetFullName()} {SqlBuilderHelper.ConvertBinaryOperationToString(Operation)} {valueString}", parameters )); }