Entity Framework 7 -The entity type 'object' requires a key to be defined

entity-framework entity-framework-core

Question

I am getting this error when migrating in EF 7

Microsoft.Data.Entity.Metadata.ModelItemNotFoundException: The entity type 'object' requires a key to be defined.

I am not sure what I am doing wrong. This is the dependencies I am using on project.json

  • "EntityFramework.SqlServer": "7.0.0-beta5",
  • "EntityFramework.Commands": "7.0.0-beta5"

Popular Answer

Most likely you're using some Data annotations that are not yet supported so you will need to use the Fluent API for configuration.

https://github.com/aspnet/EntityFramework/issues/1913

Using [ComplexType] in Entity Framework Core



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why