Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Azure by (5.8k points)
After upgrading to Entity Framework 6 we've implemented our own DbExecutionStrategy. In addition to existing SqlAzureExecutionStrategy, our strategy also logs exceptions. As turned out, every 15-30 minutes Entity Framework throws internal SqlException  System.Data.SqlClient.SqlException (0x80131904): Invalid column name 'CreatedOn'. It's an internal error. Seems like EF does some regular checks if the CreatedOn column exists on some table. Is there any elegant way to prevent this exception to be thrown?

1 Answer

0 votes
by (9.6k points)

If you are working on Visual Studio, try resetting it. 

Before you reset it, make sure you have a backup. You can do so with the following steps:

  1. Remove MigrationHistory table from the Database

  2. Remove individual migration files that’s in your project migration folder

  3. Enable-Migrations in Package Manager Console

  4. Add migration Initial in PMC

  5. Comment the code inside of the Up method in the Initial Migration

  6. Update the database in PMC (does nothing but creates Migration Entry)

  7. Remove comments in the Initial method

31k questions

32.9k answers

500 comments

693 users

Browse Categories

...