❔ Error adding new model in EF Core
I'm trying to add a new model "Tickets" in my ASP.NET Core web API. After trying to update the database with a migration, it slaps me in the face with
These are the (hopefully) relevant currently existing models I have:
I've looked around and tried adding this in my OnModelCreating:
which gave the same error. Any help would be appreciated :)
3 Replies
What are the options for
DeleteBehavior? should be something closer to 'do nothing' than 'restrict'just tried
DeleteBehavior.NoAction which gave the same error
might be worth noting, this is what my entire OnModelCreating looks like:
I've tried placing the base.OnModelCreating(builder); which led to the same error
Also tried removing base.OnModelCreating(builder); but that gave me this error:
The entity type 'IdentityUserLogin<string>' requires a primary key to be defined. If you intended to use a keyless entity type, call 'HasNoKey' in 'OnModelCreating'.
After dropping all tables and trying the migration again, everything seems to work as intendedWas this issue resolved? If so, run
/close - otherwise I will mark this as stale and this post will be archived until there is new activity.