Код: Выделить всё
dotnet ef migrations add InitialCreate --output-dir data\Migrations
Версия инструментов Entity Framework «8.0.10» старше этой среды выполнения «9.0.0-rc.2.24474.1». Обновите инструменты для получения новейших функций и исправлений ошибок. Дополнительную информацию см. на https://aka.ms/AAc1fbw.
Невозможно создать «DbContext» типа «RuntimeType». Исключение «Невозможно разрешить службу для типа Microsoft.EntityFrameworkCore.DbContextOptions`1[GameStore.data.GameStoreContext]» при попытке активировать GameStore.data.GameStoreContext». был выброшен при попытке создать экземпляр. Сведения о различных шаблонах, поддерживаемых во время разработки, см. на странице https://go.microsoft.com/fwlink/?linkid=851728
Мой .csproj файл:
Код: Выделить всё
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