I’m reverse engineering a database with Entity Framework Power Tools beta 2, now, the POCOs created do not have the [Key] in the definition, but the mapping with Fluent has the this.HasKey(t => t.EntityId);
I have the POCOs in a separate project and and MVC 4 application which has a reference to it. When I try to add a controller it says then entities do not have the Key defined.
Exact message is:
System.Data.Entity.EdmEntityType: EntityType: ‘Computer’ has no key defined. Define the key for this EntityType.
Why the reverse engineering process do not add the [Key] attribute if it is mandatory? Or it is not mandatory and I’m missing something?
Thanks in advance. Guillermo.
The problem was with connectionString to the database. Now I’ve the connectionStrings.config file set and it works.
NOTE: Worked to use reverse engineering but on runtime it fails again complaining about the [Key]
\tSystem.Data.Entity.Edm.EdmEntityType: : EntityType ‘Computer’ has no key defined. Define the key for this EntityType.