Код: Выделить всё
Dotnet new tool-manifestКод: Выделить всё
Dotnet tool install dotnet-ef --version 8Код: Выделить всё
Dotnet tool install dotnet-aspnet-codegenerator --version 8Код: Выделить всё
Dotnet add package Microsoft.EntityFrameworkCore.Sqlite --version 8.0.0Код: Выделить всё
Dotnet add package Microsoft.EntityFrameworkCore.Tools --version 8.0.0Код: Выделить всё
Dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore --version 8.0.0Код: Выделить всё
Dotnet add package Microsoft.AspNetCore.Identity.UI --version 8.0.0Код: Выделить всё
Dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design --version 8.0.0Код: Выделить всё
Dotnet restore --forceКод: Выделить всё
Class to modelsКод: Выделить всё
Guid string decimalКод: Выделить всё
Data folder in solutionКод: Выделить всё
Add class app db contextКод: Выделить всё
Using framework core and name.modelsКод: Выделить всё
Appdbcontext:dbcontextКод: Выделить всё
public ApplicationDbContext(DbContextOptions options) : base(options) { }Код: Выделить всё
public DbSet
Products => Set();Код: Выделить всё
appsettingsКод: Выделить всё
{Код: Выделить всё
"ConnectionStrings": {Код: Выделить всё
"DefaultConnection": "Data Source=app.db"Код: Выделить всё
Program csКод: Выделить всё
Add data stringsКод: Выделить всё
builder.Services.AddDbContext(options =>Код: Выделить всё
options.UseSqlite(Код: Выделить всё
builder.Configuration.GetConnectionString("DefaultConnection")));Код: Выделить всё
migrations add initialcreateКод: Выделить всё
database updateКод: Выделить всё
new scaffolded item in controllersКод: Выделить всё
click mvc on left then with viewsКод: Выделить всё
model class = productКод: Выделить всё
db context = appdbcontextКод: Выделить всё
app db contextКод: Выделить всё
using Microsoft.AspNetCore.Identity.EntityFrameworkCore at topКод: Выделить всё
dbcontext -> identitydbcontextКод: Выделить всё
program.csКод: Выделить всё
builder.ServicesКод: Выделить всё
.AddDefaultIdentity(options =>Код: Выделить всё
{Код: Выделить всё
options.SignIn.RequireConfirmedAccount = false;Код: Выделить всё
})Код: Выделить всё
.AddEntityFrameworkStores();Код: Выделить всё
Above use authorisationКод: Выделить всё
app.UseAuthentication();Код: Выделить всё
add app.MapRazorPages(); above app.Run();Код: Выделить всё
dotnet ef Migrations add AddIdentityКод: Выделить всё
dotnet ef database updateКод: Выделить всё
in main section at top add new scaffolded itemКод: Выделить всё
click identity then addКод: Выделить всё
override all filesПодробнее: https://stackoverflow.com/questions/799 ... l-database