Open PiemP opened 9 months ago
You cannot run count with order by. Your code should look like this instead
// Build the query
var query = _session.Query<ContentItem, FaqIndex>()
.With<FaqIndex>(x => x.ContentType == Constants.CONTENT_TYPE);
// count the records
var total = await query.CountAsync();
// add order by
query = query.OrderByDescending(x => x.Type);
// get the list of records.
pageOfContentItems = await query.ListAsync();
It's possible that the CountAsync
call used to remove the order clauses ... so a breaking change. Not saying it's wrong.
@sebastienros you are right, the CountAsync()
method clear order by after internally by cloning the sql-builder. so it should not impact the query.
Good evening,
If I try to run this code with YesSql that connect to a DB over SQL Server 2019:
I obtain this exception:
From miniprofile I can see this sql query:
If I use SQL Lite as a SQL database, I don't have any exception.
Thank you.