Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add migration error using AddCustomIdentity #10

Open
pavini opened this issue Apr 15, 2021 · 3 comments
Open

Add migration error using AddCustomIdentity #10

pavini opened this issue Apr 15, 2021 · 3 comments

Comments

@pavini
Copy link

pavini commented Apr 15, 2021

I'm trying to use AddCustomIdentity() 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; }
    }
@pavini
Copy link
Author

pavini commented Apr 22, 2021

Isso é uso errado da ferramenta ou algo que precisa ser ajustado?

@biproberkay
Copy link

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

@biproberkay
Copy link

hey @pavini I suppoose found the solution.

  • first: dotnet ef dbcontext list you 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.MyIntIdentityContext use like this.
  • and that is ok it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants