2

I've added a simply Product-class (shown below) but when I run add-migration it generates an empty script. I guess this is hard to troubleshoot but any idea as to why this is?

public class Product { public int ProductID { get; set; }

    [Required]
    public string Name { get; set; }

    [DataType(DataType.Currency)]
    public decimal Price { get; set; }
}

public class ProductDBContext : DbContext
{
    public DbSet<Product> Products { get; set; }
}

The migration file looks like this:

public partial class test : DbMigration { public override void Up() { }

    public override void Down()
    {
    }
}
tereško
  • 58,060
  • 25
  • 98
  • 150
Misbit
  • 347
  • 2
  • 20

2 Answers2

1

Have you added the according Class to your DB context?

public System.Data.Entity.DbSet YourDbSetName { get; set; }

Dave
  • 263
  • 3
  • 12
-1

Try Clearing out _MigrationHistory (and possible also opening your Project.Data.csproj to manually delete te migrations pending)

I found the answer here: solution

Community
  • 1
  • 1
nclsvh
  • 2,628
  • 5
  • 30
  • 52