私はこのチュートリアル asp.net Movie Tutorial を勉強していて、モデルに 2 つの単純なファイルがあります。
public class Movie
{
public int ID { get; set; }
[Required]
public string Title { get; set; }
}
public class MovieDBContext : DbContext
{
public DbSet<Movie> Movies { get; set; }
}
もう 1 つは、Visual Studio が提供するアカウント モデルです。
public class UsersContext : DbContext
{
public UsersContext()
: base("DefaultConnection")
{
}
public DbSet<UserProfile> UserProfiles { get; set; }
}
[Table("UserProfile")]
public class UserProfile
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int UserId { get; set; }
public string UserName { get; set; }
}
問題は....プロパティを追加すると
public int aaa { get; set; }
UserProfile クラスに、移行で変更はありません....これは、移行が MovieDBContext 内にあるクラスのみを更新するために発生します....したがって、次のようなものを追加する必要があります。
public class MovieDBContext : DbContext
{
public DbSet<Movie> Movies { get; set; }
public DbSet<UserProfile> User{get;set}
}
問題は、別のプロジェクトで AccountModel を更新しようとしていて、この解決策を試しましたが、うまくいかなかったことです..誰か別の解決策を知っていますか?