アプリケーションに 2 つの DBContext クラスがあります。MyMvcContextおよび自動生成されUserContextます。
私はMyMvcContextしばらく使用してWebアプリを開発してきました。UserProfileここで、 contextにあるクラスを変更する必要がありますUsersContex。クラスの変更をデータベースに移行しようとして、次のコマンドを実行しました。ただし、実行時にエラーメッセージが表示されましたEnable-Migrations -ContextTypeName MyMvc.Models.UsersContextか?
PM> Enable-Migrations
More than one context type was found in the assembly 'MyMvc'.
To enable migrations for MyMvc.Models.UsersContext, use Enable-Migrations -ContextTypeName MyMvc.Models.UsersContext.
To enable migrations for MyMvc.Models.MyMvcContext, use Enable-Migrations -ContextTypeName MyMvc.Models.MyMvcContext.
PM> Enable-Migrations -ContextTypeName MyMvc.Models.UsersContext
Migrations have already been enabled in project 'MyMvc'. To overwrite the existing migrations configuration, use the -Force parameter.
更新:プロジェクト ファイル内のすべてUsersContextを
検索して置き換える必要がありますか?MyMvcContext