Hi I was wondering if there was a way to use disinct on with ef core? I have looked through the npgsql documentation and could not find anything which would help me. So am I out of luck? Or is there some workaround?
Seems that we can do it only with FromSql for now, and it's a feature of Postgres:
if (context.Database.IsNpgsql()) // check Postgres provider
{
var query = context.SomeData.FromSql("select distinct on (id) * from some_data order by id, date desc");
// actions query.ToListAsync(), query.CountAsync() etc
// ...
}
else
{
// Other providers/exception
}