Entity Framework: ERROR: Die Konfiguration aus der Datei [...]/AppSettings.json nicht geladen hat; Es kann keinen 'DBCon
Posted: 12 Apr 2025, 18:15
Ich bin auf den folgenden Fehler gestoßen: < /p>
Beim Versuch, einen Befehlsdotnet -EF -Migrationen auszuführen, fügen Sie initial .
Code: Select all
Unable to create a 'DbContext' of type ''. The exception 'Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContextOptions`1[FourGameApp.Data.DataContext]' while attempting to activate 'FourGameApp.Data.DataContext'.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
Code: Select all
using FourGameApp.Entities;
using Microsoft.EntityFrameworkCore;
namespace FourGameApp.Data
{
public class DataContext : DbContext
{
public DataContext(DbContextOptions options) : base(options) { }
public DbSet Games { get; set; }
}
}