protected override Expression VisitConstant(ConstantExpression expression) { var namedParameter = _parameterAggregator.AddParameter(expression.Value); //TODO: ordering or named arguments? _sqlExpression.Append($"{namedParameter.Name}"); return(expression); }
public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index) { switch (resultOperator) { case FirstResultOperator _: _queryParts.FetchPart = "FETCH ?"; _parameterAggregator.AddParameter(1); break; case CountResultOperator _: _queryParts.SelectPart = string.Format($"cast(count({_queryParts.SelectPart}) as int)"); break; default: throw new NotSupportedException("Only Count() result operator is showcased in this sample. Adding Sum, Min, Max is left to the reader."); } base.VisitResultOperator(resultOperator, queryModel, index); }