EF Code First を使用したクラス ライブラリがあります。EF 4.3 にアップグレードしたばかりで、移行を有効にしたいと考えています。
Enable-Migrations -ProjectName MyProjectName
PM コンソールに入力すると、次のエラーが表示されます
PM> Enable-Migrations -ProjectName MyProjectName
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at System.Data.Entity.Migrations.DbMigrationsConfiguration.GetSqlGenerator(String providerInvariantName)
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.MigrationScaffolder..ctor(DbMigrationsConfiguration migrationsConfiguration)
at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.RunCore()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
The given key was not present in the dictionary.
PM>
どの辞書が間違っているのかわかりません。
私の接続文字列は次のようになります。
<connectionStrings>
<add name="MySystem" connectionString="Data Source=MyServer\Instance;Initial Catalog=myDbName;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
何が間違っている可能性がありますか?
注意:
app.config の正確なコピーを使用してコンソール アプリケーションでクラス ライブラリを使用すると、データベースに完全にアクセスできます。