DEV Community

Discussion on: OData without Entity Framework in ASP.NET 6.0 and performing CRUD operations

Collapse
 
rockgecko_dev profile image
Rockgecko

What is db.GetEmp().ToList();? And wouldn't calling ToList() enumerate every record in the db?

Collapse
 
renukapatil profile image
Renuka Patil

Hey @Rockgecko thanks for reading the blog, I hope this is helping you.
Coming to the first question instead of (db.GetEmp().ToList();) it would be (db.GetStudent().ToList();) that was by mistaken, you can check runnable code on github. And using the ToList() method return the list instance with appropriate elements, yes ToList() will enumerate every record in database as in Get action we retrieve all the data in list.