Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for .Net7 and EF #225

Merged
merged 5 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 28 additions & 14 deletions examples/X.PagedList.Mvc.Example.Core/Program.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace X.PagedList.Mvc.Example.Core;

public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllersWithViews();

var app = builder.Build();
if (builder.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseRouting();

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
app.UseAuthorization();

app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");

app.Run();
}
}
56 changes: 0 additions & 56 deletions examples/X.PagedList.Mvc.Example.Core/Startup.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/X.PagedList.Mvc.Core/Fluent/HtmlPagerBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace X.PagedList.Mvc.Core.Fluent;

using System;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Rendering;
using System;

internal sealed class HtmlPagerBuilder : IHtmlPagerBuilder
{
Expand Down
2 changes: 1 addition & 1 deletion src/X.PagedList.Mvc.Core/Fluent/HtmlPagerExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace X.PagedList.Mvc.Core.Fluent;

using System.Linq;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Linq;

public static class HtmlPagerExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion src/X.PagedList.Mvc.Core/Fluent/IHtmlPagerBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace X.PagedList.Mvc.Core.Fluent;

using System;
using Microsoft.AspNetCore.Html;
using System;

public interface IHtmlPagerBuilder
{
Expand Down
2 changes: 1 addition & 1 deletion src/X.PagedList.Mvc.Core/HtmlHelperExtension.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Html;
using X.PagedList.Web.Common;
using System;
using X.PagedList.Web.Common;
using IHtmlHelper = Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper;

namespace X.PagedList.Mvc.Core;
Expand Down
2 changes: 1 addition & 1 deletion src/X.PagedList.Mvc.Core/TagBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

namespace X.PagedList.Mvc.Core;

using Microsoft.AspNetCore.Html;
using System.IO;
using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Html;

internal sealed class TagBuilder : ITagBuilder
{
Expand Down
2 changes: 1 addition & 1 deletion src/X.PagedList.Mvc.Core/X.PagedList.Mvc.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<AssemblyOriginatorKeyFile>xpagedlist.snk</AssemblyOriginatorKeyFile>
<LangVersion>default</LangVersion>
<PackageVersion>8.4.3</PackageVersion>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/X.PagedList/BasePagedList.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using JetBrains.Annotations;
using System;
using System.Collections;
using System.Collections.Generic;
using JetBrains.Annotations;

namespace X.PagedList;

Expand Down Expand Up @@ -67,7 +67,7 @@ protected internal BasePagedList(int pageNumber, int pageSize, int totalItemCoun
HasNextPage = pageNumberIsGood && PageNumber < PageCount;
IsFirstPage = pageNumberIsGood && PageNumber == 1;
IsLastPage = pageNumberIsGood && PageNumber == PageCount;

var numberOfFirstItemOnPage = (PageNumber - 1) * PageSize + 1;

FirstItemOnPage = pageNumberIsGood ? numberOfFirstItemOnPage : 0;
Expand Down
4 changes: 2 additions & 2 deletions src/X.PagedList/IPagedList.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Generic;
using JetBrains.Annotations;
using JetBrains.Annotations;
using System.Collections.Generic;

namespace X.PagedList;

Expand Down
Loading