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
Beim Versuch, einen Befehlsdotnet -EF -Migrationen auszuführen, fügen Sie initial .
using FourGameApp.Entities;
using Microsoft.EntityFrameworkCore;
namespace FourGameApp.Data
{
public class DataContext : DbContext
{
public DataContext(DbContextOptions options) : base(options) { }
public DbSet Games { get; set; }
}
}
Ich bin auf den folgenden Fehler gestoßen: < /p> [code]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] Beim Versuch, einen Befehlsdotnet -EF -Migrationen auszuführen, fügen Sie initial .[code]using FourGameApp.Entities; using Microsoft.EntityFrameworkCore;
namespace FourGameApp.Data { public class DataContext : DbContext { public DataContext(DbContextOptions options) : base(options) { } public DbSet Games { get; set; } } } [/code]
Ich versuche derzeit, einen Einheit /Integrationstest zu schreiben, indem ich den Anbieter von Memory -Datenbank unter Verwendung eines Memory -Datenbankanbieters zu schreiben habe. Entity Framework...
In meinem .NET-Web-API-Projekt speichere ich die Versionsnummer meiner JavaScript-Datei wie folgt in appsettings.json:
{
JSSettings : {
Version : 1.0.0
}
}
In meinem .NET-Web-API-Projekt speichere ich die Versionsnummer meiner JavaScript-Datei wie folgt in appsettings.json:
{
JSSettings : {
Version : 1.0.0
}
}
Ich verwende EF Core in .NET 9 und möchte Daten säen, um eine JSON -Datei über das EF -Kernmigrationssystem zu veröffentlichen, und ich weiß nicht wirklich, wie es geht. programm.cs Wenn ich den...