-1

i have create a cron job with asp.net core and mysql and hangfire, but when i run my project that got me an error like this the customset table doesn't exists so i have created a table called customset and rerun the project but that got me again an error like this MySql.Data.MySqlClient.MySqlException: 'Unknown column 'Key' in 'field list'. can anyone help me?

bagher
  • 11
  • 1
  • 2
  • the answer your current question is no. Provide relevant code. At the moment the only help I can give is that there is an unknown column `Key` in `field list`. Which seems self explanatory without the relevant code to look at – Kevin Jul 23 '19 at 13:36
  • What is `customset`? It seems not to be related with hangfire. Do you create this dbset manaually in your dbcontext. Make sure all the fields in the `customset` exist in the database. – Edward Jul 24 '19 at 05:15

1 Answers1

0

Generally, that error means that your entity class and the database table are out of sync. Based on the entity class, the provider is trying to select a column that doesn't actually exist on the corresponding table in the database, which means you've likely added a property to the class and didn't do a migration to propagate that change to the database.

Long and short, you need to add a migration and update your database, or if you're going with a database-first approach, fix your database so that it matches your entity class or just rerun the scaffolding.

Chris Pratt
  • 232,153
  • 36
  • 385
  • 444