Efficient pagination using OFFSET-FETCH on SQL Server.
| ID | Name | Category | Price | Stock | Rating | Reviews | SKU |
|---|---|---|---|---|---|---|---|
| 1923 | Professional Food & Grocery Product XL | Food & Grocery | $190.84 | 258 | ★ 2.1 | 552 | SKU-001923 |
| 1924 | Super Electronics Product 2024 | Electronics | $788.66 | 44 | ★ 3.3 | 980 | SKU-001924 |
| 1926 | Ultra Home & Garden Product Advanced | Home & Garden | $538.56 | 455 | ★ 4.6 | 434 | SKU-001926 |
| 1927 | Elite Health & Beauty Product Plus | Health & Beauty | $301.21 | 426 | ★ 1.8 | 282 | SKU-001927 |
| 1928 | Economy Food & Grocery Product Pro | Food & Grocery | $496.38 | 269 | ★ 1.3 | 856 | SKU-001928 |
| 1929 | Professional Home & Garden Product Max | Home & Garden | $799.02 | 467 | ★ 2.1 | 30 | SKU-001929 |
| 1930 | Economy Automotive Product Special Edition | Automotive | $321.08 | 108 | ★ 4.3 | 977 | SKU-001930 |
| 1931 | Professional Home & Garden Product Special Edition | Home & Garden | $337.79 | 61 | ★ 3.9 | 662 | SKU-001931 |
| 1932 | Standard Electronics Product Lite | Electronics | $151.53 | 390 | ★ 1.7 | 18 | SKU-001932 |
| 1933 | Standard Books Product Max | Books | $252.95 | 192 | ★ 3.4 | 428 | SKU-001933 |
| 1934 | Deluxe Toys & Games Product Lite | Toys & Games | $188.56 | 194 | ★ 1.2 | 101 | SKU-001934 |
| 1935 | Professional Office Supplies Product Advanced | Office Supplies | $193.56 | 457 | ★ 2.3 | 266 | SKU-001935 |
| 1936 | Deluxe Toys & Games Product Pro | Toys & Games | $731.74 | 22 | ★ 4.2 | 705 | SKU-001936 |
| 1937 | Deluxe Toys & Games Product Advanced | Toys & Games | $758.12 | 499 | ★ 2.9 | 949 | SKU-001937 |
| 1938 | Pro Office Supplies Product Pro | Office Supplies | $110.47 | 426 | ★ 1.5 | 830 | SKU-001938 |
| 1939 | Deluxe Toys & Games Product XL | Toys & Games | $589.13 | 382 | ★ 4.0 | 853 | SKU-001939 |
| 1940 | Pro Food & Grocery Product Plus | Food & Grocery | $569.86 | 412 | ★ 1.1 | 156 | SKU-001940 |
| 1941 | Mega Toys & Games Product Advanced | Toys & Games | $191.85 | 254 | ★ 4.3 | 199 | SKU-001941 |
| 1942 | Ultra Home & Garden Product Classic | Home & Garden | $226.68 | 287 | ★ 4.1 | 175 | SKU-001942 |
| 1943 | Standard Sports & Outdoors Product Lite | Sports & Outdoors | $737.71 | 415 | ★ 4.9 | 738 | SKU-001943 |
| 1945 | Deluxe Food & Grocery Product Advanced | Food & Grocery | $803.89 | 203 | ★ 3.2 | 650 | SKU-001945 |
| 1946 | Ultra Electronics Product Advanced | Electronics | $280.16 | 159 | ★ 4.0 | 931 | SKU-001946 |
| 1948 | Ultra Books Product 2024 | Books | $622.42 | 450 | ★ 3.1 | 396 | SKU-001948 |
| 1949 | Professional Health & Beauty Product 2024 | Health & Beauty | $425.75 | 218 | ★ 2.8 | 826 | SKU-001949 |
| 1950 | Super Home & Garden Product Lite | Home & Garden | $805.14 | 133 | ★ 1.1 | 753 | SKU-001950 |
| 1951 | Deluxe Office Supplies Product Advanced | Office Supplies | $838.33 | 145 | ★ 2.4 | 550 | SKU-001951 |
| 1952 | Elite Automotive Product Lite | Automotive | $85.33 | 247 | ★ 1.7 | 638 | SKU-001952 |
| 1954 | Pro Home & Garden Product Advanced | Home & Garden | $614.85 | 243 | ★ 1.9 | 322 | SKU-001954 |
| 1955 | Mega Clothing Product Lite | Clothing | $163.53 | 170 | ★ 1.6 | 643 | SKU-001955 |
| 1956 | Ultra Clothing Product Max | Clothing | $175.75 | 167 | ★ 3.0 | 167 | SKU-001956 |
| 1957 | Elite Health & Beauty Product Mini | Health & Beauty | $205.95 | 54 | ★ 4.4 | 435 | SKU-001957 |
| 1958 | Pro Books Product XL | Books | $521.66 | 22 | ★ 2.1 | 979 | SKU-001958 |
| 1959 | Mega Automotive Product 2024 | Automotive | $45.89 | 217 | ★ 2.9 | 760 | SKU-001959 |
| 1960 | Premium Electronics Product 2024 | Electronics | $792.16 | 454 | ★ 3.6 | 451 | SKU-001960 |
| 1961 | Premium Automotive Product Classic | Automotive | $248.46 | 72 | ★ 1.2 | 519 | SKU-001961 |
| 1962 | Mega Sports & Outdoors Product Classic | Sports & Outdoors | $819.75 | 266 | ★ 4.0 | 664 | SKU-001962 |
| 1963 | Ultra Toys & Games Product Mini | Toys & Games | $182.26 | 413 | ★ 1.8 | 373 | SKU-001963 |
| 1964 | Pro Clothing Product XL | Clothing | $104.83 | 82 | ★ 1.1 | 474 | SKU-001964 |
| 1965 | Mega Toys & Games Product Lite | Toys & Games | $498.86 | 255 | ★ 2.3 | 141 | SKU-001965 |
| 1966 | Elite Electronics Product Special Edition | Electronics | $69.37 | 211 | ★ 3.3 | 898 | SKU-001966 |
| 1967 | Premium Health & Beauty Product Special Edition | Health & Beauty | $780.00 | 480 | ★ 1.3 | 175 | SKU-001967 |
| 1968 | Professional Health & Beauty Product Plus | Health & Beauty | $274.97 | 415 | ★ 4.4 | 368 | SKU-001968 |
| 1969 | Professional Toys & Games Product Mini | Toys & Games | $407.27 | 13 | ★ 4.2 | 602 | SKU-001969 |
| 1970 | Pro Clothing Product Special Edition | Clothing | $75.12 | 33 | ★ 1.3 | 206 | SKU-001970 |
| 1971 | Elite Home & Garden Product Special Edition | Home & Garden | $865.56 | 410 | ★ 3.7 | 63 | SKU-001971 |
| 1972 | Deluxe Electronics Product Special Edition | Electronics | $136.25 | 495 | ★ 1.6 | 53 | SKU-001972 |
| 1974 | Deluxe Home & Garden Product 2024 | Home & Garden | $980.80 | 290 | ★ 1.1 | 304 | SKU-001974 |
| 1975 | Super Toys & Games Product Advanced | Toys & Games | $756.96 | 245 | ★ 1.4 | 917 | SKU-001975 |
| 1976 | Premium Health & Beauty Product Plus | Health & Beauty | $414.85 | 301 | ★ 1.6 | 519 | SKU-001976 |
| 1978 | Pro Clothing Product Mini | Clothing | $544.81 | 309 | ★ 2.8 | 605 | SKU-001978 |
| 1979 | Pro Automotive Product Mini | Automotive | $144.65 | 37 | ★ 2.5 | 562 | SKU-001979 |
| 1980 | Economy Health & Beauty Product Advanced | Health & Beauty | $743.67 | 376 | ★ 3.8 | 899 | SKU-001980 |
| 1981 | Standard Books Product Mini | Books | $900.60 | 426 | ★ 3.2 | 395 | SKU-001981 |
| 1982 | Professional Food & Grocery Product Classic | Food & Grocery | $405.35 | 219 | ★ 3.8 | 878 | SKU-001982 |
| 1983 | Super Office Supplies Product XL | Office Supplies | $22.74 | 215 | ★ 2.6 | 983 | SKU-001983 |
| 1984 | Deluxe Sports & Outdoors Product Advanced | Sports & Outdoors | $945.84 | 229 | ★ 3.6 | 567 | SKU-001984 |
| 1985 | Mega Sports & Outdoors Product Max | Sports & Outdoors | $427.54 | 291 | ★ 1.6 | 479 | SKU-001985 |
| 1986 | Professional Office Supplies Product Special Edition | Office Supplies | $314.96 | 150 | ★ 2.4 | 743 | SKU-001986 |
| 1987 | Mega Electronics Product 2024 | Electronics | $609.06 | 269 | ★ 4.6 | 252 | SKU-001987 |
| 1988 | Professional Sports & Outdoors Product 2024 | Sports & Outdoors | $475.69 | 184 | ★ 4.1 | 307 | SKU-001988 |
| 1989 | Deluxe Office Supplies Product Pro | Office Supplies | $75.37 | 418 | ★ 3.7 | 502 | SKU-001989 |
| 1990 | Professional Toys & Games Product XL | Toys & Games | $306.30 | 98 | ★ 2.8 | 560 | SKU-001990 |
| 1991 | Standard Home & Garden Product Classic | Home & Garden | $37.20 | 210 | ★ 3.4 | 947 | SKU-001991 |
| 1992 | Ultra Books Product 2024 | Books | $627.40 | 481 | ★ 3.0 | 522 | SKU-001992 |
| 1995 | Deluxe Automotive Product Pro | Automotive | $700.98 | 108 | ★ 3.9 | 873 | SKU-001995 |
| 1996 | Super Clothing Product Advanced | Clothing | $918.63 | 99 | ★ 1.6 | 863 | SKU-001996 |
| 1997 | Mega Automotive Product Advanced | Automotive | $209.82 | 207 | ★ 3.7 | 889 | SKU-001997 |
| 1998 | Deluxe Sports & Outdoors Product Mini | Sports & Outdoors | $833.19 | 43 | ★ 1.6 | 467 | SKU-001998 |
| 1999 | Super Electronics Product Plus | Electronics | $625.95 | 448 | ★ 2.0 | 181 | SKU-001999 |
| 2000 | Elite Food & Grocery Product Advanced | Food & Grocery | $570.58 | 411 | ★ 2.5 | 117 | SKU-002000 |
| 2001 | Economy Toys & Games Product Mini | Toys & Games | $284.69 | 55 | ★ 1.5 | 846 | SKU-002001 |
| 2002 | Pro Health & Beauty Product Plus | Health & Beauty | $522.69 | 460 | ★ 4.5 | 394 | SKU-002002 |
| 2003 | Ultra Home & Garden Product Classic | Home & Garden | $191.40 | 333 | ★ 3.3 | 88 | SKU-002003 |
| 2004 | Pro Books Product Mini | Books | $600.71 | 176 | ★ 1.7 | 142 | SKU-002004 |
| 2005 | Elite Electronics Product Lite | Electronics | $208.66 | 332 | ★ 1.4 | 385 | SKU-002005 |
| 2006 | Standard Electronics Product Mini | Electronics | $959.69 | 275 | ★ 3.2 | 271 | SKU-002006 |
| 2007 | Pro Office Supplies Product Advanced | Office Supplies | $447.33 | 410 | ★ 4.2 | 685 | SKU-002007 |
| 2008 | Professional Health & Beauty Product Plus | Health & Beauty | $13.19 | 373 | ★ 2.7 | 542 | SKU-002008 |
| 2009 | Ultra Toys & Games Product Special Edition | Toys & Games | $961.72 | 229 | ★ 4.6 | 247 | SKU-002009 |
| 2010 | Mega Clothing Product 2024 | Clothing | $979.62 | 341 | ★ 2.0 | 714 | SKU-002010 |
| 2011 | Mega Food & Grocery Product XL | Food & Grocery | $918.27 | 335 | ★ 4.3 | 153 | SKU-002011 |
| 2012 | Elite Toys & Games Product Classic | Toys & Games | $919.78 | 14 | ★ 4.4 | 232 | SKU-002012 |
| 2013 | Super Food & Grocery Product Special Edition | Food & Grocery | $65.18 | 23 | ★ 3.4 | 621 | SKU-002013 |
| 2014 | Elite Clothing Product Pro | Clothing | $175.95 | 212 | ★ 2.2 | 916 | SKU-002014 |
| 2016 | Pro Toys & Games Product Special Edition | Toys & Games | $322.14 | 171 | ★ 1.3 | 666 | SKU-002016 |
| 2017 | Standard Clothing Product Special Edition | Clothing | $82.44 | 136 | ★ 1.1 | 932 | SKU-002017 |
| 2018 | Deluxe Health & Beauty Product Pro | Health & Beauty | $840.46 | 312 | ★ 5.0 | 233 | SKU-002018 |
| 2019 | Pro Food & Grocery Product Advanced | Food & Grocery | $210.67 | 201 | ★ 2.4 | 593 | SKU-002019 |
| 2020 | Premium Health & Beauty Product 2024 | Health & Beauty | $828.97 | 95 | ★ 4.2 | 17 | SKU-002020 |
| 2021 | Deluxe Home & Garden Product 2024 | Home & Garden | $427.87 | 0 | ★ 1.9 | 117 | SKU-002021 |
| 2022 | Mega Home & Garden Product 2024 | Home & Garden | $942.23 | 443 | ★ 4.4 | 686 | SKU-002022 |
| 2023 | Premium Electronics Product XL | Electronics | $642.34 | 230 | ★ 4.0 | 252 | SKU-002023 |
| 2024 | Economy Toys & Games Product Advanced | Toys & Games | $981.32 | 247 | ★ 2.0 | 306 | SKU-002024 |
| 2025 | Pro Food & Grocery Product Special Edition | Food & Grocery | $149.09 | 286 | ★ 3.7 | 78 | SKU-002025 |
| 2027 | Super Toys & Games Product Pro | Toys & Games | $549.07 | 133 | ★ 2.3 | 993 | SKU-002027 |
| 2028 | Professional Health & Beauty Product Lite | Health & Beauty | $280.05 | 67 | ★ 3.5 | 814 | SKU-002028 |
| 2029 | Mega Electronics Product Special Edition | Electronics | $859.54 | 485 | ★ 2.8 | 546 | SKU-002029 |
| 2032 | Elite Automotive Product Advanced | Automotive | $755.69 | 383 | ★ 2.1 | 761 | SKU-002032 |
| 2033 | Mega Health & Beauty Product Advanced | Health & Beauty | $761.92 | 317 | ★ 2.7 | 286 | SKU-002033 |
| 2034 | Pro Toys & Games Product Special Edition | Toys & Games | $619.09 | 197 | ★ 3.2 | 513 | SKU-002034 |
// 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
};
}