Home > Blockchain >  Entity Framework - async select with where multiple conditions
Entity Framework - async select with where multiple conditions

Time:10-09

I'm using ASP.NET Core with Entity Framework.

I have found this working command on Stackoverflow

var d = await db.Employee.Where(x => x.FirstName == "Jack").ToListAsync();

at the following link : Entity Framework - async select with where condition

Please tell me how can I load the table records into a list based on multiple where conditions.

I want something like that :

var d = await db.Employee.Where(x => x.LastName == "Smith" 
                                     and x => x.Country == "UK" 
                                     and x => x.Age == 45 etc)

CodePudding user response:

You are almost there

var d = await db.Employee.Where(x => x.LastName == "Smith" 
                          && x.Country == "UK"
                           && x.Age == 45)
                          .ToListAsync();
  • Related