Open ReneKochITTitans opened 1 month ago
@ReneKochITTitans
Which version of the ef tool do you run? What versions of EntitityFramework related packages to do you reference?
Can you run the command with --verbose
flag? Maybe it'll give a more descriptive error.
Which version of Microsoft.IdentityModel are you using?
(In Bug case I updated to 8.0.2 / 8.1.0, both created the bug)
Where is the issue? see above
Is this a new or an existing app? App exists since a few years.
Repro When upgrading my nugets from 7.6.0 to 8.x, the EF Core migration command fails. It works, when I dont upgrade.
EF Command: dotnet ef migrations add Test (but also fails on e.g. dotnet ef migrations has-pending-model-changes)
DbContext:
` public class GenesisDbContext : DbContext { private readonly IHttpContextAccessor _httpContextAccessor;
`
When I run with 7.6.0 the command dotnet ef migrations has-pending-model-changes I get: No changes have been made to the model since the last migration.
When I upgrade to 8.1.0 I Get: Unable to create a 'DbContext' of type ''. The exception 'Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContextOptions`1[SMS.Server.Genesis.Data.GenesisDbContext]' while attempting to activate 'KommuneAktiv.SMS.Server.Genesis.Data.GenesisDbContext'.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
Expected behavior Migration worked as before
Actual behavior Migration command throws error: Unable to create a 'DbContext' of type ''. The exception 'Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContextOptions`1[SMS.Server.Genesis.Data.GenesisDbContext]' while attempting to activate 'KommuneAktiv.SMS.Server.Genesis.Data.GenesisDbContext'.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728