Async loads, related data and performance
This example is the ticket browser with EF Core
logging on in Development, the grid query as a no-tracking projection with paging of 50 in SQL, and the
editor's related data loaded deliberately (the last five comments by a filtered no-tracking read, the full
history by explicit loading on demand). The naive branch the lab starts from is kept in
TicketQueryService.SearchTicketsNaiveAsync as the measured baseline for the tests and the lab notes.
Run it
cd "LearnWisej-Samples/Data Binding with EF Core Course/Module 6/SupportDesk.Web"
dotnet run -f net10.0 --urls http://localhost:5406
In Development every EF Core command is written to the console with an [EF] prefix (LogTo), with its
SQL and elapsed time. Tests: dotnet test SupportDesk.Tests (TicketPerformanceTests compares the two branches).
What to try
- Search / Next / Previous: the console shows two statements per page of 50, a
COUNTand oneSELECTthat joins the customer, agent and category names. The grid shows Number, Title, Customer, Agent, Category, Status, Due and Updated. Search, Next and Previous are disabled while a page loads. - Empty result, failed query: No tickets match these filters; a failure shows a friendly
AlertBox. - Edit Ticket: the comments list shows the last five comments; Show full history loads them all.