Entity Framework Core count does not have optimal performance

前端 未结 9 1548
故里飘歌
故里飘歌 2020-12-20 12:19

I need to get the amount of records with a certain filter.

Theoretically this instruction:

_dbContext.People.Count (w => w.Type == 1);
         


        
9条回答
  •  情话喂你
    2020-12-20 12:45

    Try to use this lambda expression for execute query faster.

    _dbContext.People.select(x=> x.id).Count();
    

提交回复
热议问题