The instance of entity type {ModelName} cannot be tracked because another instance with the same key value for {‘ID’} is already being tracked
I got this error when trying to seed data to the database
How to query navigation property of IdentityRole in EF Core
Background:
I create a custom Role class extends the IdentityRole:
EF Core 8 does not merge entities
When switching from EF Core 5 to version 8, the following problem was revealed.
Microsoft.Data.SqlClient.SqlException: ‘Invalid object name ‘AspNetRole’.’
I have a table named AspNetRoles
in my database and context generated from database.
I get the error when trying to the table via context. It likely think the table name is singular and not able to find a table named AspNetRole
. Now, the question is how to adress the right table?