'There is already an object named 'Id' in the database. Could not create constraint or index

im using EF core 3.1 and trying to Update-Database after adding migration, but im getting this error "There is already an object named 'Id' in the database. Could not create constraint or index" this is my first Update-Database and nothing is in my database, in my migration i have some DbSets and some configuration in OnModelcreating for columns, i dont know why im getting this error can smb help me ? : )



Solution 1:[1]

I could find what is the problem, i used HasName method of fluent api in dbcontext class, and that was making this error, I removed it and now its ok

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 milad.bg