© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
1 reply
mmajic

IdentityServer update database error when multiple user types.

I am using IdentityServer in dotnet. I have a base type EntityUser that inherits the IdentityUser<int> class. The entityuser is a base class for multiple user types.

After creating a migration successfully with
add-migration Test
add-migration Test
and run
update-database
update-database
I get the following error:

There is already an object named 'AspNetRoles' in the database.
There is already an object named 'AspNetRoles' in the database.


Here are the relevant classes:

EntityUser.cs

public class EntityUser : IdentityUser<int>
{
    public bool Active { get; set; }
    public decimal Credits { get; set; } = 0;
    public virtual ICollection<EntityUserRole> UserRoles { get; set; } = new List<EntityUserRole>();
}
public class EntityUser : IdentityUser<int>
{
    public bool Active { get; set; }
    public decimal Credits { get; set; } = 0;
    public virtual ICollection<EntityUserRole> UserRoles { get; set; } = new List<EntityUserRole>();
}


ClubAdmin.cs

public class ClubAdmin : EntityUser
{
    public virtual ICollection<Club> Clubs { get; set; } = new List<Club>();
    // other clubadmin specific properties
}
public class ClubAdmin : EntityUser
{
    public virtual ICollection<Club> Clubs { get; set; } = new List<Club>();
    // other clubadmin specific properties
}


DJ.cs

public class DJ : EntityUser
{
    public virtual ICollection<Club> Clubs { get; set; } = null!;
    public PayoutMethod PayoutMethod { get; set; }
    //other specific properties 
}
public class DJ : EntityUser
{
    public virtual ICollection<Club> Clubs { get; set; } = null!;
    public PayoutMethod PayoutMethod { get; set; }
    //other specific properties 
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

error when Update-Database
C#CC# / help
2y ago
Swagger multiple error types
C#CC# / help
4y ago
❔ Update-Database error
C#CC# / help
4y ago
❔ Update-database error
C#CC# / help
4y ago