Nate Pet
Nate Pet

Reputation: 46312

Entity Framework - Error 11007: Entity type is not mapped.

I have a problem when I got the lasted .edmx.

I get a message that says Error 11007: Entity type 'pl_Micro' s not mapped. Looking at the designer view, I do see that this table does indeed exist.

How can I overcome this meesage?

Upvotes: 40

Views: 90577

Answers (7)

Tabish Sarwar
Tabish Sarwar

Reputation: 1535

From MSDN:

Error 11007: Entity Type Is Not Mapped

This error occurs when an entity type in the conceptual model is not mapped to the data source. To resolve this error, map the entity type to the data source. Look at the MSDN link

How to: Map Entities to Database Tables

Upvotes: 30

Khushbu Lil
Khushbu Lil

Reputation: 11

I got this error because I had to update the table column type. Refresh table in SQL server and re-add table in the entity framework for resolving this.

Upvotes: 0

user12777720
user12777720

Reputation: 1

Correct, close visual study, enter the * .edmx file with a notepad ++, sublime text, notepad, etc., search the table, search the column and modify the column size (MaxLength), in all matches, in My case was 2, but they can be more. Start visual studio and the change is already accepted.

Upvotes: 0

thebenman
thebenman

Reputation: 1621

I got this error because I had copy pasted an entity and modified it. Restarting visual studio resolved this.

Upvotes: 1

Artur Kedzior
Artur Kedzior

Reputation: 4273

This happens also when you import tables via diagram in edmx and then you point in app.config to different instance of database (switching from dev db to test db for example)

Upvotes: 2

fmedina
fmedina

Reputation: 21

This error was passed to me by the SQL Server Authentication server did not have the necessary permissions and could not see the entities.

Confirm that your sql user has the necessary permissions in the database.

Upvotes: 2

Giles Roberts
Giles Roberts

Reputation: 6883

I get this error when I move a database table to a different schema or delete a database table. In this case Entity Framework doesn't seem to update the edmx file correctly when you Update Model from Database....

The way I resolved this was to do a text search for the name of the offending entity. I then removed all references to this in the xml view of the edmx file, deleted the corresponding cs file that defines the entity, and any other references in the project.

Upvotes: 5

Related Questions