Код: Выделить всё
dotnet ef migrations add InitialCreate --output-dir data\MigrationsКод: Выделить всё
Build started...
Build succeeded.
The Entity Framework tools version '8.0.10' is older than that of the runtime '9.0.0-rc.2.24474.1'. Update the tools for the latest features and bug fixes. See https://aka.ms/AAc1fbw for more information.
Unable to create a 'DbContext' of type 'RuntimeType'. The exception 'Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContextOptions`1[GameStore.data.GameStoreContext]' while attempting to activate 'GameStore.data.GameStoreContext'.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
Код: Выделить всё
net8.0
enable
enable
runtime; build; native; contentfiles; analyzers; buildtransitive
all
Код: Выделить всё
GameStoreContext.cs:
using System;
using GameStore.Entities;
using Microsoft.EntityFrameworkCore;
namespace GameStore.data
{
public class GameStoreContext(DbContextOptions options) : DbContext(options)
{
// DbSets representing tables in your database
public DbSet Games { get; set; }
public DbSet Genres { get; set; }
}
}
Код: Выделить всё
appsettings.json:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"GameStore": "Data Source=GameStore.db"
}
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... ework-core
Мобильная версия