dotnet / dotnet/AspNetCore.Docs

Add custom ApplicationUser as DbSet to ApplicationDbContext.

Open
#15,708 0 comments 1 reaction 0 assignees View on GitHub
doc-enhancement Pri2 Source - Docs.ms
Dominant language
C#
Stars
13.1k
Forks
24.6k
Avg merge
1d 3h
Merged PRs (30d)
97

Description

Hello,

I wanted to mention that I was following these instructions and everything worked great until I added a relationship to my custom ApplicationUser from one of my own models in the same context.

At that point, the next migration I created re-added all the identity tables!

I rolled back that migration, and found this post on StackOverflow that says I should add a DbSet<ApplicationUser> to my context, and then it will work.

https://stackoverflow.com/a/53415884

This did the trick, I wanted to suggest you add this to the documentation for this topic.

Thanks!

Jayme

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: d9869895-9ba2-5027-46cd-89d1d995cba4
* Version Independent ID: 8750939b-6ae5-3b9a-6c32-5e84b7fea22c
* Content: [Identity model customization in ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/security/authentication/customize-identity-model?view=aspnetcore-3.0)
* Content Source: [aspnetcore/security/authentication/customize-identity-model.md](https://github.com/aspnet/AspNetCore.Docs/blob/master/aspnetcore/security/authentication/customize-identity-model.md)
* Product: **aspnet-core**
* Technology: **aspnetcore-security**
* GitHub Login: @ajcvickers
* Microsoft Alias: **avickers**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.