EF 4.1 Code First error - The entity type SomeType is not part of the model for the current context

rovsen picture rovsen · Apr 12, 2011 · Viewed 38.5k times · Source

While working with EF code first I get error given below at different times:

The entity type SomeType is not part of the model for the current context.

What are the possible causes of this error?

Answer

rovsen picture rovsen · Apr 12, 2011

It may occur because:

  • DbContext configured with an incorrect connection string
  • The entity specified is actually not mapped in configuration