私の同僚が、モデル クラスから生成された UserProfiles テーブルをデータベースから誤って削除してしまいました。
モデルクラスは次のようになります。
namespace OneMillion.Models
{
[Table("UserProfile")]
public class User
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int UserId { get; set; }
public string UserName { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
public string Sex { get; set; }
public string SecretQuestion { get; set; }
public string SecretQuestionAnswer { get; set; }
public int MoneyIn { get; set; }
public int MoneyOut { get; set; }
public int TimesWon { get; set; }
}
}
パッケージ マネージャー コンソール経由で Update-Database を実行しようとすると、次のエラーが発生します。
Cannot find the object "dbo.UserProfile" because it does not exist or you do not have permissions.
データ移行が有効になっています。どうすればこれを解決できますか? データベース全体を削除しますか?