Hello, I noticed that ServiceStack.OrmLite.OrmLiteReadExpressionsApiAsync.SingleAsync< T >(this IDbConnection dbConn, ISqlExpression expression, CancellationToken token = default) and ServiceStack.OrmLite.OrmLiteReadExpressionsApi.Single< T >(this IDbConnection dbConn, ISqlExpression expression) don’t limit the number of results returned from the query on provided SqlExpression. (ServiceStack 8.2.2)
I think it would make sense to limit the number of results to 1 (with TOP 1 in SqlServer) as the rest of the results are discarded anyway.
Kind regards,
Tomaž Petek
Single just returns a single record, like if you search by Primary Key, it doesn’t alter your query.
If you want it to limit it to 1result add it to your query expression, e.g: