digipolisantwerp / dataaccess_aspnetcore_deprecated

Generic repository/unit of work framework for ASP.NET Core with Entity Framework.
Other
140 stars 45 forks source link

Another way to write #42

Closed Kris-I closed 7 years ago

Kris-I commented 7 years ago

Hello,

Is there an another solution than the classic on to right with your framework? return customerRepo.GetAll().Where(x => x.Reference.ToLower() == reference.ToLower()).FirstOrDefault();

Thanks,

StevenVandenBroeck commented 7 years ago

Hi @Kris-I ,

with the GetAll method you are retrieving all records from the database and then filter in memory, that is probably not what you want. You can use the Query method on the repository to pass in that filter so it is executed on the database. More info here : https://github.com/digipolisantwerp/dataaccess_aspnetcore#query.