I have tried as below :
removed all the generated scripts which it relates to model on the
Migrationsfolder.removed all the entries whcih it relates to model on the
__MigrationHistorytable.
But it creates like this when I run:
PM> Add-Migration "Added_Investors_Table"
Generated migration script
public partial class Added_Investors_Table : DbMigration
{
public override void Up()
{
}
public override void Down()
{
}
}
Model
[Table("Investors")]
public class Investor : FullAuditedEntity
{
public virtual int AmountCommitted { get; set; }
public virtual decimal PercentageOfDeal { get; set; }
public virtual decimal AmountSpentToDate { get; set; }
}
DbContext.cs
public class IpDbContext : AbpZeroDbContext<Tenant, Role, User>
{
/* Define an IDbSet for each entity of the application */
public virtual IDbSet<Investor> Investors { get; set; }
public IpDbContext() : base("Default")
{
}
}
Do you know why it does not recreate a migration script as usual ? What are the other places, should I remove this model other than the above mentioned 2 places ?
Note : The above mentioned table is a new one.I have successfully created script first time.But due to some changes and etc.. I need to recreate it again.But it does not work.But If I change existing model then it gives change set script.Very strange no ? I don't know where's the problem is..
-IgnoreChanges. Have a look at my answer here for the steps. Might work for you.Investor. Thus, your VERY last EF migration contains information about theInvestorentity, even after deleting any previous code migration or__MigrationHistoryentry related toInvestor. You have to find a way to trick EF to believe it has a model withoutInvestorin it, and then create a new migration to scaffoldInvestoragain