4

I keep getting this error on initial load of my application. I have searched high and low and the only thing I found to do was the code below in my context.

Database.SetInitializer<Context>(null);

I have this set in the OnModelCreating method but it is still throwing the error below:

System.Data.SqlClient.SqlException: Invalid object name 'dbo.EdmMetadata'. System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details.

danatcofo
  • 703
  • 8
  • 18
chadn
  • 117
  • 2
  • 10
  • It says *See the inner exception for details* - Did you do that using the debugger ? – Zein Makki Jul 21 '16 at 05:45
  • I haven't figured out how to capture that exception because it is occurring on initial compile of Entity Framework. – chadn Jul 21 '16 at 06:06

1 Answers1

5

You should add this code in constructor of your Context class.

Michał Kuliński
  • 1,928
  • 3
  • 27
  • 51