Entity Framework - Invalid Column Name '*_ID"

后端 未结 15 1611
长发绾君心
长发绾君心 2020-11-29 21:30

I\'ve narrowed this down to some issue between Code First and Database first EF, but I\'m not sure how to fix it. I\'ll try to be as clear as I can, but I honestly am missin

15条回答
  •  暖寄归人
    2020-11-29 21:58

    For me, it happened because of EF's pluralization issues. For tables that ends with something like "-Status", EF thinks that it's singular is "-Statu". Changing the entity and DB table name to "-StatusTypes" fixed it.

    This way, you would not need to rename entity models everytime it gets updated.

提交回复
热议问题