Search code examples
c#.net-coreentity-framework-coreaspnetboilerplate

AspNetZero 4.6.1 - Entity Type "Capture" requires a primary key to be defined


I recently updated my version of Visual Studio to 15.8.2. I am now no longer able to build my AspNetZero MVC project. I get the error that Entity Type "Capture" requires a primary key. The problem is "Capture" exists no where within the project. I believe it is compiled.

Has anyone else with AspNetZero had this issue and knows how to fix?

From the modelBuilder debug view:

EntityType: Capture
Properties: 
  Discriminator (no field, string) Shadow Required AfterSave:Throw 0 0 -1 0 -1
    Annotations: 
      ValueGeneratorFactory: System.Func`3[Microsoft.EntityFrameworkCore.Metadata.IProperty,Microsoft.EntityFrameworkCore.Metadata.IEntityType,Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator]
  GroupTempId1 (no field, Nullable<int>) Shadow FK Index 1 1 0 1 -1
  TempId (no field, Nullable<int>) Shadow Required AlternateKey AfterSave:Throw 2 2 1 2 -1
  TempId1 (no field, int) Shadow Required AlternateKey AfterSave:Throw 3 3 2 3 -1
Keys: 
  TempId
  TempId1
Foreign keys: 
  Capture {'GroupTempId1'} -> Group {'TempId1'} ToDependent: Captures
Annotations: 
  Relational:DiscriminatorProperty: Discriminator
  Relational:DiscriminatorValue: Capture
  RelationshipDiscoveryConvention:NavigationCandidates: System.Collections.Immutable.ImmutableSortedDictionary`2[System.Reflection.PropertyInfo,System.Type]

Solution

  • I don't know why this was happening but when I re-pulled down from my main branch in TFS, cleaned, rebuild, and played the project locally, everything started working again.