From 36b11ec0a6923753e59a9824120b559d4b9beb57 Mon Sep 17 00:00:00 2001 From: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:23:34 -1000 Subject: [PATCH] Create readme.txt (#33265) * Create readme.txt * Delete aspnetcore/data/ef-rp/intro/samples/cu80 directory --- .../ef-rp/intro/samples/cu80/PaginatedList.cs | 36 ------------------- .../cu80/appsettings.Development2.json | 13 ------- .../data/ef-rp/intro/samples/cu90/readme.txt | 1 + 3 files changed, 1 insertion(+), 49 deletions(-) delete mode 100644 aspnetcore/data/ef-rp/intro/samples/cu80/PaginatedList.cs delete mode 100644 aspnetcore/data/ef-rp/intro/samples/cu80/appsettings.Development2.json create mode 100644 aspnetcore/data/ef-rp/intro/samples/cu90/readme.txt diff --git a/aspnetcore/data/ef-rp/intro/samples/cu80/PaginatedList.cs b/aspnetcore/data/ef-rp/intro/samples/cu80/PaginatedList.cs deleted file mode 100644 index ee7c475e0f..0000000000 --- a/aspnetcore/data/ef-rp/intro/samples/cu80/PaginatedList.cs +++ /dev/null @@ -1,36 +0,0 @@ -// See https://github.com/dotnet/AspNetCore.Docs/pull/28082 -// This code has been proposed but has not be tested. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.EntityFrameworkCore; - -namespace ContosoUniversity -{ - public class PaginatedList : List - { - public PaginatedList(IEnumerable items, int count, int pageIndex, int pageSize = 20) - { - PageIndex = pageIndex; - TotalPages = (int)Math.Ceiling(count / (double)pageSize); - - this.AddRange(items); - } - - public bool HasPreviousPage => PageIndex > 1; - public bool HasNextPage => PageIndex < TotalPages; - public int PageIndex { get; private set; } - public int TotalPages { get; private set; } - - public static async Task> CreateAsync( - IQueryable source, int pageIndex, int pageSize = 20) - { - var count = await source.CountAsync(); - var items = await source.Skip( - (pageIndex - 1) * pageSize) - .Take(pageSize).ToListAsync(); - return new PaginatedList(items, count, pageIndex, pageSize); - } - } -} diff --git a/aspnetcore/data/ef-rp/intro/samples/cu80/appsettings.Development2.json b/aspnetcore/data/ef-rp/intro/samples/cu80/appsettings.Development2.json deleted file mode 100644 index e6b72983f6..0000000000 --- a/aspnetcore/data/ef-rp/intro/samples/cu80/appsettings.Development2.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "DetailedErrors": true, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "ConnectionStrings": { - "SchoolContextSQLite": "Data Source=CU.db" - }, - "MyMaxModelBindingCollectionSize": "3" -} diff --git a/aspnetcore/data/ef-rp/intro/samples/cu90/readme.txt b/aspnetcore/data/ef-rp/intro/samples/cu90/readme.txt new file mode 100644 index 0000000000..b021bd3465 --- /dev/null +++ b/aspnetcore/data/ef-rp/intro/samples/cu90/readme.txt @@ -0,0 +1 @@ +Delete this readme file when the code has been updated to .NET 9