title: How should I deal with an EF code first model where no entities have keys?
body: <p>I have used the Entity Data Model Wizard to generate an EF data model (an edmx with POCO's) based on the Object Catalogue Views in SQL Server, i.e. sys.objects, sys.tables, sys.columns, etc. When I try to access any data through my DbContext's DbSet properties, EF throws a ModelValidationException, complaining that entities don't have keys defined.</p>
  
  <p>I can easily modify the T4 template that generates the entity POCOs to include a dummy property marked with the [Key] attribute, but this seems a bit klunky, as now my entity classes have a 'phantom' property that doesn't belong to them. Choosing a name for the key column is also an issue, but I could do something like generate a GUID for a unique key column name for ever class.</p>
  
  <p>But, isn't there a better, neater way of telling EF I don't need key columns, as this model is strictly read only?</p>
  
  <p><strong>ADDENDUM:</strong> If I use the <em>Entity Framework Power Tools - Reverse Engineer Code First</em> tool, it creates a mapping class (derived from <code>EntityTypeConfiguration</code>) for each entity, and where the entity has no define key, it defines one using all the fields in the entity.</p>