Migration does not alter my table

前端 未结 2 1039
灰色年华
灰色年华 2020-12-22 01:29

I just enabled migrations in my project and added a few fields to UserProfile:

[Table(\"UserProfile\")]
public class UserProfile
{
    [Key]
            


        
2条回答
  •  误落风尘
    2020-12-22 01:50

    call this method in your startup code to have the database recreated with the new fields:

    public void CheckForDBChanes()
            {
    
                Database.SetInitializer(new DropCreateDatabaseIfModelChanges());
            }
    

提交回复
热议问题