A few things:
1. You're asking for paging however paging is not part of the EF query.
2. An EF
GET should use
NoTracking
unless you are going to update and postback to the db. In your case, you're running a pagination query and forget with Blazor, so no tracking is required.
3. Why are you using a
UnitOfWork
class for a
GET query??? A
UnitOfWork
class usually wraps operations for a
Transaction for a complex Create/Update/Delete operations across multiple operations on a datsabase, not a single
GET.
4. You don't need to iterate over the EF collection, you can convert as part of the Linq query. It will be quicker.
List<CategoryDto> categoryDtos = allCategories
.Where(e => e.Code.ToLower().Contains(searchText.ToLower())
|| e.Name.ToLower().Contains(searchText.ToLower()))
.Select(x => x.ConvertToDto()
.ToList();
Quote:
parameters are changed. pageIndex and pageSize parameters are set to empty string although they are integer type.
Are you talking in your razor page? Both the razor page and
PaginationUtility
class code are missing from your question, so we can't see how this is happening. Please click on the green
Improve question link and update your question