Add migration error using AddCustomIdentity
I'm trying to use AddCustomIdentity<ApplicationUser>() and I'm getting this error when run the add migration command.
No DbContext named 'NetDevPackAppDbContext' was found.
File IdentityConfig.cs
services.AddIdentityEntityFrameworkContextConfiguration(options =>
options.UseSqlServer(configuration.GetConnectionString("DefaultConnection"),
b => b.MigrationsAssembly("Equinox.Infra.CrossCutting.Identity")))
.AddCustomIdentity<ApplicationUser>();
ApplicationUser.cs
public class ApplicationUser : IdentityUser
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
Isso é uso errado da ferramenta ou algo que precisa ser ajustado?
i am getting this error for AddCustomIdentityAndKeyConfiguration. i have an idea about the reason : the user role context and configuratyion classes are both in one file. i look for that stacoverflow answer
hey @pavini I suppoose found the solution.
- first:
dotnet ef dbcontext listyou will see 👇
AspNetCore.Jwt.Sample.Config.MyIntIdentityContext AspNetCore.Jwt.Sample.Config.MyIdentityContext
- theese two copy your context
dotnet ef migrations add Initial -c AspNetCore.Jwt.Sample.Config.MyIntIdentityContextuse like this.- and that is ok it works.