Resolving 'No key Defined' errors while using OnModelCreating with ApplicationDbContext?

后端 未结 3 759
我寻月下人不归
我寻月下人不归 2021-01-12 11:40

I\'ve been trying to create navigation properties for my collection types and I found this example of how one person accomplished it using OnModelCreating. I gave it a try i

3条回答
  •  孤城傲影
    2021-01-12 12:08

    I know this is a late response, and this may only work for people working off tutorials or school projects!

    For me, just deleting the database, .mdf, and migrations folder fixed it. Now, I don't know if you are using migrations, but this worked for me.

    I'm a novice, but what I've noticed is that Identity is very finicky with keys. Deleting the migration has helped with every (godforsaken) migration problem I've hit with my project.

提交回复
热议问题