Efficient pagination using OFFSET-FETCH on SQL Server.
| ID | Name | Category | Price | Stock | Rating | Reviews | SKU |
|---|---|---|---|---|---|---|---|
| 4273 | Mega Home & Garden Product Special Edition | Home & Garden | $759.64 | 201 | ★ 2.9 | 802 | SKU-004273 |
| 4274 | Professional Toys & Games Product Lite | Toys & Games | $307.74 | 214 | ★ 3.7 | 531 | SKU-004274 |
| 4275 | Premium Health & Beauty Product Special Edition | Health & Beauty | $15.98 | 243 | ★ 2.7 | 620 | SKU-004275 |
| 4276 | Standard Books Product 2024 | Books | $828.42 | 193 | ★ 2.8 | 33 | SKU-004276 |
| 4277 | Super Clothing Product Special Edition | Clothing | $530.14 | 474 | ★ 3.9 | 184 | SKU-004277 |
| 4278 | Economy Books Product Advanced | Books | $902.42 | 54 | ★ 2.3 | 143 | SKU-004278 |
| 4279 | Standard Books Product Classic | Books | $774.44 | 369 | ★ 3.7 | 794 | SKU-004279 |
| 4280 | Ultra Home & Garden Product Plus | Home & Garden | $46.65 | 136 | ★ 2.4 | 831 | SKU-004280 |
| 4281 | Standard Toys & Games Product 2024 | Toys & Games | $242.81 | 100 | ★ 3.5 | 161 | SKU-004281 |
| 4282 | Standard Toys & Games Product 2024 | Toys & Games | $871.87 | 361 | ★ 3.7 | 69 | SKU-004282 |
| 4283 | Mega Sports & Outdoors Product XL | Sports & Outdoors | $693.57 | 65 | ★ 3.4 | 264 | SKU-004283 |
| 4284 | Super Home & Garden Product Max | Home & Garden | $551.84 | 46 | ★ 2.4 | 426 | SKU-004284 |
| 4285 | Standard Home & Garden Product Plus | Home & Garden | $726.21 | 12 | ★ 5.0 | 940 | SKU-004285 |
| 4287 | Standard Sports & Outdoors Product Special Edition | Sports & Outdoors | $659.95 | 257 | ★ 2.7 | 955 | SKU-004287 |
| 4290 | Super Clothing Product Pro | Clothing | $686.49 | 285 | ★ 2.6 | 700 | SKU-004290 |
| 4291 | Deluxe Books Product Advanced | Books | $211.09 | 286 | ★ 4.5 | 864 | SKU-004291 |
| 4292 | Pro Automotive Product Mini | Automotive | $150.44 | 356 | ★ 1.7 | 577 | SKU-004292 |
| 4293 | Economy Sports & Outdoors Product Mini | Sports & Outdoors | $985.82 | 436 | ★ 2.4 | 374 | SKU-004293 |
| 4294 | Professional Home & Garden Product Pro | Home & Garden | $153.89 | 140 | ★ 4.2 | 792 | SKU-004294 |
| 4295 | Ultra Home & Garden Product XL | Home & Garden | $811.40 | 103 | ★ 1.1 | 103 | SKU-004295 |
| 4297 | Professional Books Product Max | Books | $367.27 | 91 | ★ 1.3 | 786 | SKU-004297 |
| 4298 | Economy Food & Grocery Product Max | Food & Grocery | $941.06 | 284 | ★ 3.4 | 555 | SKU-004298 |
| 4301 | Deluxe Food & Grocery Product Plus | Food & Grocery | $423.72 | 288 | ★ 1.0 | 556 | SKU-004301 |
| 4302 | Professional Books Product Max | Books | $473.20 | 30 | ★ 3.3 | 913 | SKU-004302 |
| 4304 | Super Office Supplies Product 2024 | Office Supplies | $21.44 | 9 | ★ 3.5 | 278 | SKU-004304 |
| 4305 | Professional Clothing Product Advanced | Clothing | $194.42 | 484 | ★ 3.8 | 420 | SKU-004305 |
| 4306 | Mega Toys & Games Product Pro | Toys & Games | $129.89 | 85 | ★ 2.4 | 145 | SKU-004306 |
| 4307 | Mega Health & Beauty Product 2024 | Health & Beauty | $751.25 | 5 | ★ 3.2 | 663 | SKU-004307 |
| 4309 | Premium Electronics Product XL | Electronics | $611.20 | 152 | ★ 2.9 | 368 | SKU-004309 |
| 4310 | Mega Toys & Games Product Advanced | Toys & Games | $73.16 | 271 | ★ 4.7 | 677 | SKU-004310 |
| 4311 | Deluxe Clothing Product Classic | Clothing | $51.37 | 271 | ★ 2.9 | 699 | SKU-004311 |
| 4312 | Ultra Books Product Plus | Books | $547.64 | 79 | ★ 2.7 | 621 | SKU-004312 |
| 4313 | Elite Books Product Advanced | Books | $656.93 | 346 | ★ 2.1 | 367 | SKU-004313 |
| 4314 | Premium Books Product Mini | Books | $549.05 | 160 | ★ 2.6 | 90 | SKU-004314 |
| 4315 | Elite Toys & Games Product Plus | Toys & Games | $482.31 | 381 | ★ 2.6 | 267 | SKU-004315 |
| 4316 | Elite Home & Garden Product Special Edition | Home & Garden | $596.46 | 300 | ★ 3.6 | 839 | SKU-004316 |
| 4318 | Pro Office Supplies Product Max | Office Supplies | $80.89 | 407 | ★ 4.0 | 885 | SKU-004318 |
| 4319 | Professional Automotive Product Classic | Automotive | $118.65 | 213 | ★ 4.2 | 187 | SKU-004319 |
| 4320 | Ultra Sports & Outdoors Product Special Edition | Sports & Outdoors | $68.30 | 40 | ★ 1.9 | 179 | SKU-004320 |
| 4321 | Super Automotive Product Max | Automotive | $151.85 | 6 | ★ 3.3 | 660 | SKU-004321 |
| 4322 | Economy Toys & Games Product XL | Toys & Games | $66.12 | 285 | ★ 2.6 | 279 | SKU-004322 |
| 4323 | Elite Clothing Product Advanced | Clothing | $659.70 | 399 | ★ 1.6 | 789 | SKU-004323 |
| 4324 | Mega Home & Garden Product Pro | Home & Garden | $640.07 | 492 | ★ 1.1 | 257 | SKU-004324 |
| 4326 | Mega Clothing Product Advanced | Clothing | $656.85 | 20 | ★ 1.1 | 203 | SKU-004326 |
| 4327 | Elite Food & Grocery Product Special Edition | Food & Grocery | $848.59 | 169 | ★ 1.8 | 685 | SKU-004327 |
| 4328 | Elite Books Product 2024 | Books | $545.07 | 132 | ★ 3.4 | 532 | SKU-004328 |
| 4329 | Ultra Books Product Pro | Books | $179.97 | 458 | ★ 1.7 | 586 | SKU-004329 |
| 4330 | Professional Health & Beauty Product XL | Health & Beauty | $71.17 | 41 | ★ 2.0 | 657 | SKU-004330 |
| 4331 | Professional Office Supplies Product Classic | Office Supplies | $448.63 | 24 | ★ 4.1 | 134 | SKU-004331 |
| 4332 | Mega Food & Grocery Product XL | Food & Grocery | $130.97 | 117 | ★ 2.3 | 437 | SKU-004332 |
| 4333 | Professional Toys & Games Product 2024 | Toys & Games | $313.29 | 236 | ★ 2.3 | 617 | SKU-004333 |
| 4334 | Ultra Books Product Plus | Books | $253.48 | 363 | ★ 4.6 | 561 | SKU-004334 |
| 4335 | Ultra Sports & Outdoors Product Special Edition | Sports & Outdoors | $462.56 | 72 | ★ 3.6 | 529 | SKU-004335 |
| 4336 | Pro Toys & Games Product Plus | Toys & Games | $182.73 | 45 | ★ 2.9 | 631 | SKU-004336 |
| 4337 | Economy Food & Grocery Product Advanced | Food & Grocery | $970.57 | 21 | ★ 4.7 | 365 | SKU-004337 |
| 4338 | Mega Automotive Product Mini | Automotive | $615.95 | 376 | ★ 4.4 | 110 | SKU-004338 |
| 4339 | Deluxe Food & Grocery Product Lite | Food & Grocery | $355.82 | 452 | ★ 2.5 | 634 | SKU-004339 |
| 4340 | Elite Books Product Mini | Books | $165.07 | 297 | ★ 3.0 | 810 | SKU-004340 |
| 4341 | Super Books Product XL | Books | $360.80 | 363 | ★ 4.6 | 641 | SKU-004341 |
| 4342 | Elite Books Product 2024 | Books | $895.55 | 268 | ★ 4.6 | 466 | SKU-004342 |
| 4343 | Deluxe Office Supplies Product Max | Office Supplies | $395.23 | 346 | ★ 2.8 | 256 | SKU-004343 |
| 4344 | Ultra Office Supplies Product 2024 | Office Supplies | $356.82 | 20 | ★ 1.4 | 771 | SKU-004344 |
| 4345 | Ultra Toys & Games Product XL | Toys & Games | $463.02 | 427 | ★ 4.4 | 530 | SKU-004345 |
| 4346 | Deluxe Sports & Outdoors Product Advanced | Sports & Outdoors | $957.61 | 322 | ★ 4.5 | 327 | SKU-004346 |
| 4347 | Deluxe Food & Grocery Product Classic | Food & Grocery | $303.82 | 239 | ★ 4.3 | 590 | SKU-004347 |
| 4348 | Deluxe Sports & Outdoors Product Special Edition | Sports & Outdoors | $195.57 | 36 | ★ 4.4 | 718 | SKU-004348 |
| 4349 | Pro Electronics Product Lite | Electronics | $548.79 | 112 | ★ 1.2 | 444 | SKU-004349 |
| 4350 | Standard Toys & Games Product Plus | Toys & Games | $831.16 | 355 | ★ 3.7 | 136 | SKU-004350 |
| 4351 | Economy Books Product Mini | Books | $792.61 | 336 | ★ 4.9 | 996 | SKU-004351 |
| 4352 | Mega Automotive Product Plus | Automotive | $882.00 | 285 | ★ 1.9 | 88 | SKU-004352 |
| 4353 | Ultra Home & Garden Product Classic | Home & Garden | $266.18 | 441 | ★ 2.1 | 431 | SKU-004353 |
| 4354 | Professional Sports & Outdoors Product Advanced | Sports & Outdoors | $122.46 | 171 | ★ 3.9 | 451 | SKU-004354 |
| 4355 | Economy Office Supplies Product Mini | Office Supplies | $841.89 | 415 | ★ 3.0 | 354 | SKU-004355 |
| 4356 | Super Electronics Product Classic | Electronics | $993.86 | 180 | ★ 4.3 | 682 | SKU-004356 |
| 4357 | Professional Automotive Product Max | Automotive | $978.12 | 435 | ★ 1.2 | 688 | SKU-004357 |
| 4358 | Ultra Automotive Product XL | Automotive | $608.21 | 308 | ★ 3.9 | 243 | SKU-004358 |
| 4361 | Premium Sports & Outdoors Product Plus | Sports & Outdoors | $300.50 | 247 | ★ 4.4 | 825 | SKU-004361 |
| 4362 | Standard Clothing Product Advanced | Clothing | $666.40 | 84 | ★ 3.8 | 872 | SKU-004362 |
| 4363 | Super Food & Grocery Product Plus | Food & Grocery | $735.54 | 312 | ★ 1.3 | 72 | SKU-004363 |
| 4364 | Economy Electronics Product XL | Electronics | $589.21 | 150 | ★ 1.9 | 667 | SKU-004364 |
| 4365 | Deluxe Office Supplies Product Mini | Office Supplies | $682.91 | 407 | ★ 4.6 | 966 | SKU-004365 |
| 4366 | Premium Sports & Outdoors Product 2024 | Sports & Outdoors | $348.91 | 235 | ★ 1.4 | 983 | SKU-004366 |
| 4367 | Pro Health & Beauty Product Pro | Health & Beauty | $79.27 | 152 | ★ 3.7 | 592 | SKU-004367 |
| 4368 | Mega Home & Garden Product 2024 | Home & Garden | $709.16 | 228 | ★ 1.2 | 782 | SKU-004368 |
| 4369 | Ultra Health & Beauty Product Advanced | Health & Beauty | $485.71 | 399 | ★ 4.9 | 68 | SKU-004369 |
| 4370 | Mega Sports & Outdoors Product XL | Sports & Outdoors | $321.94 | 173 | ★ 1.1 | 620 | SKU-004370 |
| 4371 | Pro Toys & Games Product Mini | Toys & Games | $923.73 | 231 | ★ 3.6 | 246 | SKU-004371 |
| 4372 | Standard Health & Beauty Product Advanced | Health & Beauty | $201.72 | 43 | ★ 2.3 | 334 | SKU-004372 |
| 4375 | Super Electronics Product Plus | Electronics | $738.16 | 92 | ★ 2.8 | 46 | SKU-004375 |
| 4376 | Ultra Health & Beauty Product Classic | Health & Beauty | $373.63 | 447 | ★ 3.2 | 699 | SKU-004376 |
| 4377 | Super Office Supplies Product Max | Office Supplies | $653.99 | 300 | ★ 3.4 | 951 | SKU-004377 |
| 4378 | Pro Sports & Outdoors Product Plus | Sports & Outdoors | $854.22 | 411 | ★ 3.5 | 750 | SKU-004378 |
| 4379 | Professional Health & Beauty Product Advanced | Health & Beauty | $672.76 | 490 | ★ 1.6 | 895 | SKU-004379 |
| 4381 | Super Toys & Games Product Mini | Toys & Games | $627.51 | 46 | ★ 1.1 | 222 | SKU-004381 |
| 4382 | Economy Office Supplies Product Pro | Office Supplies | $15.47 | 134 | ★ 1.5 | 382 | SKU-004382 |
| 4383 | Economy Office Supplies Product 2024 | Office Supplies | $583.44 | 17 | ★ 1.4 | 327 | SKU-004383 |
| 4384 | Premium Books Product Max | Books | $610.50 | 123 | ★ 1.7 | 690 | SKU-004384 |
| 4385 | Professional Toys & Games Product Lite | Toys & Games | $213.41 | 344 | ★ 3.8 | 27 | SKU-004385 |
| 4386 | Deluxe Home & Garden Product Pro | Home & Garden | $793.69 | 295 | ★ 4.3 | 462 | SKU-004386 |
| 4387 | Deluxe Office Supplies Product Special Edition | Office Supplies | $333.82 | 29 | ★ 4.2 | 569 | SKU-004387 |
// Efficient pagination with Skip and Take
public async Task<PaginatedResult<DemoProduct>> GetPaginatedProductsAsync(int page, int pageSize)
{
// Get total count (cached if possible)
var totalCount = await _context.DemoProducts.CountAsync(p => p.IsActive);
// Get page of results
var items = await _context.DemoProducts
.Where(p => p.IsActive)
.OrderBy(p => p.Id) // Important: Must have ORDER BY for consistent paging
.Skip((page - 1) * pageSize) // OFFSET in SQL
.Take(pageSize) // FETCH NEXT in SQL
.AsNoTracking() // No tracking needed for read-only
.ToListAsync();
return new PaginatedResult<DemoProduct>
{
Items = items,
TotalCount = totalCount,
Page = page,
PageSize = pageSize
};
}