Search code examples
asp.netasp.net-mvcef-code-firstaspnetboilerplateasp.net-boilerplate

How to add Column in existing table in asp Boilerplate?


As you know Boilerplate don't give the entity classes to add columns and I want to add column in table named ( AbpUser). I tried to make a class in Migrations like below

public partial class AddRatingMig : DbMigration
{
    public override void Up()
    {
        AddColumn("dbo.AbpUsers", "UserType", c => c.String());
    }

    public override void Down()
    {
        DropColumn("dbo.AbpUsers", "UserType");
    }
}

Then in Pm console run command Update-Database . But not successful. As you know Boilerplate don't give the entity classes to edit columns. Please Help Thanks in advance


Solution

  • The answer to this question is to Extend the AbpUser like this

    public class User : AbpUser<User> 
    { 
        public string SpecialTitle { get; set; } 
    }
    

    and add-migration UpdatedUserWithSpecialTitle then update-database