2016-03-27 15 views
1

Ich benutze Entity Framework Code First 6. Ich habe einige grundlegende Änderungen an meinen Entitäten vorgenommen, jetzt kann ich kein Scaffold durchführen. Ich erhalte den Fehler unten. Ich habe sogar versucht, meinen Code zurückzusetzen, als ich ein Gerüst aufbauen konnte und ich bekomme den gleichen Fehler. Ich habe Schritte, die ich in der Vergangenheit gemacht habe, um den Code zuerst komplett zurückzusetzen (die Datenbank zu löschen, Enable-Migrations -force, ...), aber das funktioniert auch nicht. Irgendwelche Ideen, wie ich diesen Fehler überwinden kann?EF6 Code First - Der Wert darf nicht null sein. Parametername: entitySet

System.ArgumentNullException: Value cannot be null. 
Parameter name: entitySet 
    at System.Data.Entity.Utilities.Check.NotNull[T](T value, String parameterName) 
    at System.Data.Entity.Core.Mapping.EntitySetMapping..ctor(EntitySet entitySet, EntityContainerMapping containerMapping) 
    at System.Data.Entity.ModelConfiguration.Edm.DbDatabaseMappingExtensions.AddEntitySetMapping(DbDatabaseMapping databaseMapping, EntitySet entitySet) 
    at System.Data.Entity.ModelConfiguration.Edm.Services.TableMappingGenerator.Generate(EntityType entityType, DbDatabaseMapping databaseMapping) 
    at System.Data.Entity.ModelConfiguration.Edm.Services.DatabaseMappingGenerator.GenerateEntityTypes(DbDatabaseMapping databaseMapping) 
    at System.Data.Entity.ModelConfiguration.Edm.Services.DatabaseMappingGenerator.Generate(EdmModel conceptualModel) 
    at System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo) 
    at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) 
    at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) 
    at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) 
    at System.Data.Entity.Internal.LazyInternalContext.InitializeContext() 
    at System.Data.Entity.Internal.LazyInternalContext.get_ModelBeingInitialized() 
    at System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext context, XmlWriter writer) 
    at System.Data.Entity.Utilities.DbContextExtensions.<>c__DisplayClass1.<GetModel>b__0(XmlWriter w) 
    at System.Data.Entity.Utilities.DbContextExtensions.GetModel(Action`1 writeXml) 
    at System.Data.Entity.Utilities.DbContextExtensions.GetModel(DbContext context) 
    at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration, DbContext usersContext, DatabaseExistenceState existenceState, Boolean calledByCreateDatabase) 
    at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration) 
    at System.Data.Entity.Migrations.Design.MigrationScaffolder..ctor(DbMigrationsConfiguration migrationsConfiguration) 
    at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Run() 
    at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate) 
    at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate) 
    at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner) 
    at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldInitialCreate(String language, String rootNamespace) 
    at System.Data.Entity.Migrations.EnableMigrationsCommand.<>c__DisplayClass2.<.ctor>b__0() 
    at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command) 
Value cannot be null. 
Parameter name: entitySet 

Antwort

3

Ich fand es heraus. Hatte eine schlecht benannte Entity "Timezone", die ich entfernt habe, weil ich sie nicht brauchte. Ich habe jedoch die virtuelle Eigenschaft "Zeitzone" in einer anderen Entität verlassen. VS kompilierte es gut, weil es dachte, dass es eine Systemklasse war, aber EF-Code warf zuerst einen Fehler auf.

Verwandte Themen