December 19, 2024

Displaying the currently loaded data while reading data from a table

Displaying the currently loaded data while reading data from a table

I have a SQL Server table that has approximately 2 million rows. Let’s say the table is called Students. If I query a database from SQL Server Management Studio:

SELECT * 
FROM Students

At the same time, the currently loaded data is displayed, and the rest of it is being loaded in the meantime. By this I mean, for example after 1 second I see 1000 lines, after 2 seconds I see 3000 lines and so on ….

However, if I use EF in my application and I query the database for the data:

var data = _context.Students.ToList();

I have to wait for all the rows of the table to load before I can access the data object.I know that theoretically I could use pagination and retrieve only part of the records (for example, from 1 – 100).

But is there any mechanism / library in the ASP.NET Core application that would allow me to display a table on the page and load the rows on the fly?