This project is read-only.


The type 'XXXX' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic


I'm getting the "The type 'XXXX' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." error despite the type not being ignored, nested or generic.

I actually had this type working properly until I moved many of its properties off to a base type that I created on another library. I have the fealing having the base type on one library, and inheritor in another and the context in a third library seems to be causing the problem.

file attachments

Closed Dec 13, 2016 at 7:58 PM by RoMiller
EF Team Triage: We are transitioning this project to GitHub ( As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base.

Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base ( Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).

This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include:
  • It was a bug report that does not contain sufficient information for us to be able to reproduce it
  • It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it
  • It is a feature request that we are realistically not going to implement on the EF6.x code base
    Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider ( We will no longer be monitoring this issue tracker for comments, so please do not reply here.


mgirgin wrote Dec 6, 2012 at 11:32 PM

Hi Ours -- could you please provide a repro for this issue?

Ours wrote Dec 14, 2012 at 7:40 AM

Hi mgirgin,

I've made a simple project where you can see the issue on Renaming Library3.Message to something else works around the issue so I'm suspecting a namespace issue.

Thank you.

Ours wrote Dec 14, 2012 at 9:18 AM

This issue seems to popup in more obscure cases as well. We use the Universal Provider for ASP.Net authentication. As we use EF5 code-first, because of the lack of multi-tenancy (I read it's coming for EF6) I have to add the Universal Provider entities to my context. We have a couple of projects working like that fine.

But in one project that both runs autonomously and as a MvcContrib portable area. When we drop the portable area into another MVC4 project all of the sudden we get the same "I'm getting the "The type 'XXXX' was not mapped" but just for the Universal Provider types. If I kick them out of my context it all works fine. I suspect that because the "host" ASP.Net application has it's own authentication, there are multiple "User" classes in different namespaces and it confuses EF5.

The host was a SiteFinity instance that we migrated to MVC4 and added our portable areas to. As we don't have control over the Universal Provider class names, we where forced to remove them from the context and have it use a different DB to prevent both contexts from fighting each other. As a workaround (EF5 namespace issues) for a workaround (current lack of multi-tenancy) it works but I hope the underlying issue is fixed eventually.


Ours wrote Dec 15, 2012 at 1:57 PM

Zip of the repro project

moozzyk wrote Dec 17, 2012 at 8:36 PM

This is because you have 2 Message entities in the hierarchy. Currently this is not supported. As soon as you rename one of the Message entities the error should go away.

Ours wrote Dec 18, 2012 at 7:03 AM

Thank you, I'm aware of the workaround. I hope this gets fixed in the next version.
I did fall on a case where I couldn't rename the classes as they where part of the Universal Provider package. Stand-alone it worked fine but the moment I put the project as a MvcContrib portable area under SiteFinity, I get the same dreaded error message.

You have to admit it's a bit of a painful limitation for larger projects.

Kind regards,

glennc wrote Dec 19, 2012 at 11:50 PM

Consider in future

This is possibly a duplicate as this is a known issue.

Ours wrote Dec 20, 2012 at 7:01 AM

A straight bug is only a "consider in future"?

ajcvickers wrote Dec 20, 2012 at 5:36 PM

Hi Ours,

Unfortunately this is not simple to fix. The way mapping between types in the model and CLR types is implemented means that significant changes need to be made to allow multiple types with the same name. This is something we plan to work on, but it seems very unlikely that it will fit into the schedule for EF6 and hence, realistically speaking, this will not make it into EF until a future release.