Używam pierwszej migracji kodu ramowego jednostki w moim projekcie mvc. Ale ostatnio po modyfikacji klasy modelu i dodaniu nowych, gdy próbuję użyć add-migration w konsoli menedżera pakietów, ciągle otrzymuję ten błąd: "Odwołanie do obiektu nie jest ustawione na instancję obiektu" używam entity framework version 5
i kiedy spróbuj użyć wersji 6, ale nie zobaczę mojego DbContext, tutaj jest mój ślad stosu, proszę każda sugestia zostanie przyjęta z zadowoleniem.Struktura podmiotu: Zezwolono na wyjątek odwołań zerowych podczas dodawania migracji w konsoli menedżera pakietów VS 2012
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.Configure(EdmEntityType entityType, EdmModel model)
at System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.ConfigureEntities(EdmModel model)
at System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo)
at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
at System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext context, XmlWriter writer)
at System.Data.Entity.Migrations.Extensions.DbContextExtensions.<>c__DisplayClass1.<GetModel>b__0(XmlWriter w)
at System.Data.Entity.Migrations.Extensions.DbContextExtensions.GetModel(Action`1 writeXml)
at System.Data.Entity.Migrations.Extensions.DbContextExtensions.GetModel(DbContext context)
at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration, DbContext usersContext)
at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration)
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator()
at System.Data.Entity.Migrations.Design.ToolingFacade.GetPendingMigrationsRunner.RunCore()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
Object reference not set to an instance of an object.
Upewnij się, że istnieją ciągi połączeń w pliku konfiguracyjnym i są poprawnie nazwane. –
Czy możemy uzyskać wewnętrzny wyjątek? –
Wygląda jak błąd. Czy możesz zgłosić na http://entityframework.codeplex.com (przejdź do Problemy -> Nowy problem)? Podczas zgłaszania należy dołączyć repro. – Pawel