Efficient pagination using OFFSET-FETCH on SQL Server.
| ID | Name | Category | Price | Stock | Rating | Reviews | SKU |
|---|---|---|---|---|---|---|---|
| 1127 | Super Clothing Product Advanced | Clothing | $151.59 | 170 | ★ 3.7 | 649 | SKU-001127 |
| 1128 | Pro Electronics Product XL | Electronics | $146.15 | 163 | ★ 2.9 | 367 | SKU-001128 |
| 1129 | Deluxe Home & Garden Product Plus | Home & Garden | $873.68 | 132 | ★ 1.5 | 753 | SKU-001129 |
| 1130 | Super Sports & Outdoors Product Pro | Sports & Outdoors | $154.17 | 427 | ★ 3.4 | 598 | SKU-001130 |
| 1131 | Professional Home & Garden Product XL | Home & Garden | $391.05 | 464 | ★ 4.3 | 886 | SKU-001131 |
| 1132 | Deluxe Electronics Product 2024 | Electronics | $901.33 | 71 | ★ 4.3 | 511 | SKU-001132 |
| 1133 | Mega Toys & Games Product Mini | Toys & Games | $493.90 | 160 | ★ 3.9 | 158 | SKU-001133 |
| 1134 | Mega Sports & Outdoors Product Mini | Sports & Outdoors | $781.40 | 19 | ★ 1.6 | 563 | SKU-001134 |
| 1135 | Super Food & Grocery Product Pro | Food & Grocery | $851.50 | 55 | ★ 3.6 | 231 | SKU-001135 |
| 1136 | Elite Electronics Product Mini | Electronics | $522.42 | 353 | ★ 1.5 | 35 | SKU-001136 |
| 1138 | Premium Toys & Games Product Pro | Toys & Games | $632.88 | 338 | ★ 1.3 | 622 | SKU-001138 |
| 1139 | Deluxe Clothing Product Classic | Clothing | $697.12 | 307 | ★ 1.2 | 781 | SKU-001139 |
| 1141 | Elite Toys & Games Product Plus | Toys & Games | $749.64 | 479 | ★ 5.0 | 657 | SKU-001141 |
| 1142 | Premium Clothing Product 2024 | Clothing | $598.14 | 296 | ★ 2.1 | 461 | SKU-001142 |
| 1144 | Standard Sports & Outdoors Product XL | Sports & Outdoors | $881.78 | 97 | ★ 1.1 | 791 | SKU-001144 |
| 1145 | Economy Office Supplies Product 2024 | Office Supplies | $286.68 | 278 | ★ 3.7 | 697 | SKU-001145 |
| 1146 | Premium Automotive Product Lite | Automotive | $223.68 | 182 | ★ 3.1 | 423 | SKU-001146 |
| 1148 | Pro Books Product Classic | Books | $405.58 | 224 | ★ 3.9 | 713 | SKU-001148 |
| 1149 | Elite Sports & Outdoors Product Plus | Sports & Outdoors | $976.29 | 335 | ★ 3.2 | 912 | SKU-001149 |
| 1150 | Premium Health & Beauty Product Mini | Health & Beauty | $184.48 | 363 | ★ 1.3 | 285 | SKU-001150 |
| 1151 | Deluxe Books Product Lite | Books | $219.99 | 210 | ★ 4.2 | 184 | SKU-001151 |
| 1152 | Standard Health & Beauty Product XL | Health & Beauty | $23.32 | 136 | ★ 1.4 | 844 | SKU-001152 |
| 1153 | Deluxe Books Product XL | Books | $307.22 | 152 | ★ 3.6 | 790 | SKU-001153 |
| 1155 | Elite Food & Grocery Product Classic | Food & Grocery | $303.05 | 469 | ★ 4.3 | 96 | SKU-001155 |
| 1156 | Premium Automotive Product Special Edition | Automotive | $202.71 | 474 | ★ 2.8 | 963 | SKU-001156 |
| 1157 | Super Sports & Outdoors Product Special Edition | Sports & Outdoors | $143.71 | 489 | ★ 1.8 | 301 | SKU-001157 |
| 1159 | Premium Food & Grocery Product Advanced | Food & Grocery | $225.15 | 254 | ★ 3.7 | 455 | SKU-001159 |
| 1160 | Professional Books Product Mini | Books | $270.32 | 239 | ★ 2.7 | 677 | SKU-001160 |
| 1161 | Super Home & Garden Product XL | Home & Garden | $92.62 | 228 | ★ 1.0 | 691 | SKU-001161 |
| 1162 | Ultra Health & Beauty Product Lite | Health & Beauty | $565.88 | 247 | ★ 4.2 | 949 | SKU-001162 |
| 1163 | Professional Clothing Product Pro | Clothing | $147.33 | 89 | ★ 3.7 | 719 | SKU-001163 |
| 1164 | Super Food & Grocery Product Classic | Food & Grocery | $161.87 | 303 | ★ 4.9 | 574 | SKU-001164 |
| 1165 | Elite Books Product Max | Books | $21.11 | 450 | ★ 4.6 | 173 | SKU-001165 |
| 1166 | Economy Home & Garden Product Classic | Home & Garden | $745.66 | 379 | ★ 4.4 | 640 | SKU-001166 |
| 1167 | Pro Health & Beauty Product Special Edition | Health & Beauty | $479.86 | 348 | ★ 2.9 | 296 | SKU-001167 |
| 1168 | Economy Toys & Games Product Lite | Toys & Games | $356.62 | 385 | ★ 3.5 | 76 | SKU-001168 |
| 1169 | Mega Toys & Games Product Special Edition | Toys & Games | $467.91 | 20 | ★ 4.6 | 728 | SKU-001169 |
| 1170 | Standard Health & Beauty Product Mini | Health & Beauty | $514.33 | 396 | ★ 2.5 | 457 | SKU-001170 |
| 1171 | Pro Electronics Product Special Edition | Electronics | $518.28 | 238 | ★ 2.6 | 518 | SKU-001171 |
| 1172 | Deluxe Electronics Product Max | Electronics | $69.98 | 276 | ★ 3.6 | 770 | SKU-001172 |
| 1173 | Economy Electronics Product Mini | Electronics | $295.99 | 173 | ★ 4.2 | 90 | SKU-001173 |
| 1174 | Deluxe Automotive Product Max | Automotive | $494.05 | 444 | ★ 3.5 | 917 | SKU-001174 |
| 1175 | Elite Clothing Product XL | Clothing | $332.75 | 383 | ★ 1.9 | 744 | SKU-001175 |
| 1176 | Deluxe Toys & Games Product XL | Toys & Games | $159.32 | 92 | ★ 2.5 | 513 | SKU-001176 |
| 1178 | Premium Books Product 2024 | Books | $709.38 | 243 | ★ 4.0 | 638 | SKU-001178 |
| 1179 | Premium Books Product Lite | Books | $834.76 | 218 | ★ 4.1 | 189 | SKU-001179 |
| 1180 | Premium Automotive Product Lite | Automotive | $464.49 | 182 | ★ 3.8 | 212 | SKU-001180 |
| 1181 | Ultra Clothing Product Classic | Clothing | $29.25 | 0 | ★ 1.1 | 35 | SKU-001181 |
| 1182 | Standard Electronics Product XL | Electronics | $433.20 | 417 | ★ 3.3 | 842 | SKU-001182 |
| 1185 | Mega Food & Grocery Product Plus | Food & Grocery | $279.97 | 38 | ★ 2.7 | 707 | SKU-001185 |
| 1186 | Super Automotive Product Lite | Automotive | $882.04 | 45 | ★ 3.4 | 394 | SKU-001186 |
| 1188 | Professional Sports & Outdoors Product Mini | Sports & Outdoors | $819.13 | 121 | ★ 1.4 | 723 | SKU-001188 |
| 1189 | Elite Clothing Product Max | Clothing | $129.65 | 323 | ★ 2.1 | 695 | SKU-001189 |
| 1190 | Mega Home & Garden Product Classic | Home & Garden | $453.60 | 311 | ★ 2.2 | 475 | SKU-001190 |
| 1191 | Pro Food & Grocery Product Advanced | Food & Grocery | $121.00 | 182 | ★ 1.0 | 225 | SKU-001191 |
| 1192 | Economy Toys & Games Product 2024 | Toys & Games | $264.31 | 443 | ★ 4.6 | 931 | SKU-001192 |
| 1193 | Deluxe Automotive Product Special Edition | Automotive | $52.08 | 158 | ★ 3.3 | 392 | SKU-001193 |
| 1194 | Standard Toys & Games Product Advanced | Toys & Games | $267.26 | 69 | ★ 3.6 | 900 | SKU-001194 |
| 1195 | Economy Automotive Product 2024 | Automotive | $821.98 | 1 | ★ 1.7 | 158 | SKU-001195 |
| 1196 | Ultra Office Supplies Product Plus | Office Supplies | $323.55 | 371 | ★ 4.8 | 479 | SKU-001196 |
| 1197 | Elite Clothing Product Max | Clothing | $918.46 | 345 | ★ 2.8 | 802 | SKU-001197 |
| 1199 | Premium Clothing Product Mini | Clothing | $644.90 | 20 | ★ 3.7 | 62 | SKU-001199 |
| 1201 | Premium Health & Beauty Product Special Edition | Health & Beauty | $144.16 | 61 | ★ 2.9 | 922 | SKU-001201 |
| 1202 | Deluxe Electronics Product Pro | Electronics | $294.63 | 397 | ★ 1.7 | 205 | SKU-001202 |
| 1203 | Elite Automotive Product Mini | Automotive | $691.83 | 11 | ★ 3.7 | 249 | SKU-001203 |
| 1204 | Premium Sports & Outdoors Product Plus | Sports & Outdoors | $937.15 | 242 | ★ 2.8 | 462 | SKU-001204 |
| 1205 | Deluxe Books Product Special Edition | Books | $481.34 | 325 | ★ 1.7 | 994 | SKU-001205 |
| 1206 | Pro Sports & Outdoors Product Special Edition | Sports & Outdoors | $227.82 | 313 | ★ 3.6 | 258 | SKU-001206 |
| 1207 | Professional Books Product Mini | Books | $547.33 | 392 | ★ 4.1 | 541 | SKU-001207 |
| 1210 | Standard Sports & Outdoors Product 2024 | Sports & Outdoors | $99.35 | 416 | ★ 3.6 | 728 | SKU-001210 |
| 1211 | Economy Food & Grocery Product Lite | Food & Grocery | $661.49 | 138 | ★ 3.4 | 367 | SKU-001211 |
| 1212 | Ultra Office Supplies Product Max | Office Supplies | $137.58 | 433 | ★ 1.5 | 577 | SKU-001212 |
| 1213 | Pro Electronics Product Advanced | Electronics | $857.31 | 24 | ★ 4.8 | 827 | SKU-001213 |
| 1215 | Super Books Product Classic | Books | $926.41 | 295 | ★ 2.1 | 812 | SKU-001215 |
| 1216 | Elite Books Product Pro | Books | $909.51 | 98 | ★ 3.2 | 305 | SKU-001216 |
| 1217 | Premium Health & Beauty Product Plus | Health & Beauty | $928.75 | 169 | ★ 4.1 | 153 | SKU-001217 |
| 1218 | Deluxe Electronics Product Plus | Electronics | $559.56 | 76 | ★ 4.3 | 851 | SKU-001218 |
| 1219 | Economy Books Product Plus | Books | $206.48 | 39 | ★ 1.7 | 555 | SKU-001219 |
| 1222 | Ultra Sports & Outdoors Product Classic | Sports & Outdoors | $81.48 | 161 | ★ 1.9 | 449 | SKU-001222 |
| 1223 | Premium Toys & Games Product Special Edition | Toys & Games | $161.40 | 344 | ★ 4.3 | 212 | SKU-001223 |
| 1224 | Super Electronics Product XL | Electronics | $457.61 | 384 | ★ 3.7 | 382 | SKU-001224 |
| 1225 | Elite Health & Beauty Product Pro | Health & Beauty | $17.24 | 374 | ★ 3.5 | 350 | SKU-001225 |
| 1226 | Mega Toys & Games Product Advanced | Toys & Games | $169.76 | 363 | ★ 2.8 | 918 | SKU-001226 |
| 1227 | Deluxe Automotive Product XL | Automotive | $657.02 | 70 | ★ 2.9 | 921 | SKU-001227 |
| 1228 | Pro Books Product Lite | Books | $944.62 | 203 | ★ 3.0 | 317 | SKU-001228 |
| 1229 | Super Books Product Special Edition | Books | $465.10 | 487 | ★ 4.8 | 208 | SKU-001229 |
| 1230 | Professional Toys & Games Product Plus | Toys & Games | $795.69 | 184 | ★ 4.4 | 991 | SKU-001230 |
| 1231 | Elite Home & Garden Product Classic | Home & Garden | $284.85 | 340 | ★ 4.7 | 30 | SKU-001231 |
| 1232 | Pro Health & Beauty Product Lite | Health & Beauty | $743.47 | 253 | ★ 4.8 | 748 | SKU-001232 |
| 1233 | Pro Food & Grocery Product Special Edition | Food & Grocery | $613.52 | 185 | ★ 2.2 | 71 | SKU-001233 |
| 1234 | Deluxe Home & Garden Product Plus | Home & Garden | $657.78 | 337 | ★ 4.6 | 247 | SKU-001234 |
| 1235 | Deluxe Food & Grocery Product Plus | Food & Grocery | $491.24 | 296 | ★ 4.4 | 955 | SKU-001235 |
| 1236 | Deluxe Automotive Product Classic | Automotive | $890.63 | 497 | ★ 1.0 | 296 | SKU-001236 |
| 1237 | Pro Books Product XL | Books | $866.71 | 332 | ★ 4.5 | 949 | SKU-001237 |
| 1239 | Elite Clothing Product XL | Clothing | $409.93 | 337 | ★ 2.0 | 531 | SKU-001239 |
| 1240 | Mega Toys & Games Product Advanced | Toys & Games | $259.66 | 377 | ★ 4.0 | 981 | SKU-001240 |
| 1241 | Pro Toys & Games Product Special Edition | Toys & Games | $591.07 | 33 | ★ 4.2 | 388 | SKU-001241 |
| 1242 | Elite Home & Garden Product Classic | Home & Garden | $576.58 | 279 | ★ 2.6 | 398 | SKU-001242 |
| 1243 | Ultra Office Supplies Product Special Edition | Office Supplies | $915.01 | 97 | ★ 2.8 | 390 | SKU-001243 |
| 1244 | Pro Health & Beauty Product Plus | Health & Beauty | $986.51 | 267 | ★ 3.7 | 595 | SKU-001244 |
// 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
};
}