I want to select all rows from a table using the following type of syntax:
public IQueryable<Company> GetCompanies()
{
return DbContext.Set<Company>()
.// Select all
}
Forgive me as I am completely new to EF.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Set<T>()is alreadyIQueryable<T>and it returns all rows from tableAlso generated
DbContextwill have named properties for each table. Look forDbContext.Companies– it’s same asDbContext.Set<Company>()