Is there global query SORTERS like query FILTERS in EF core

325 Views Asked by At

Is there something like IHaveOrder interface and all entities (classes) that implement it ordered by default when getall()

1

There are 1 best solutions below

0
Arcord On

You could achieve that in your DBContext :

public  class MyDbContext : DbContext
{
   public DbSet<MyEntity> MyEntities { get; set; }
   public IQueryable<MyEntity> MyOrderedEntities => MyEntities.OrderBy(...)
}