Какое решение может помочь мне справиться с этим?
Код: Выделить всё
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Distributed;
using SportsStore.Models;
var builder = WebApplication.CreateBuilder(args);
builder
.Services.AddControllersWithViews();
builder.Services.AddRazorPages();
builder.Services.AddDbContext(opts =>
{
opts.UseNpgsql(builder.Configuration["ConnectionStrings:SportsStoreConnection"]);
});
builder.Services.AddScoped();
builder.Services.AddDistributedMemoryCache();
builder.Services.AddSession();
var app = builder.Build();
app.UseStaticFiles();
app.UseSession();
app.MapControllerRoute(
"catpage",
"{category}/Page-{page:int}",
new { Controller = "Home", action = "Index" });
app.MapControllerRoute(
"page",
"Page{page:int}",
new { Controller = "Home", action = "Index", page = 1 });
app.MapControllerRoute(
"category",
"{category}",
new { Controller = "Home", action = "Index", page = 1 });
app.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
app.MapRazorPages();
SeedData.EnsurePopulated(app);
app.Run();
Подробнее здесь: https://stackoverflow.com/questions/795 ... stem-for-r