我已经迁移了代码
CreateTable(
"dbo.InvoiceCompensations",
c => new
{
Id = c.Int(nullable: false, identity: true),
InvoiceId = c.Int(nullable: false),
UserPaymentId = c.Int(nullable: false),
Billed = c.Boolean(nullable: false),
CreateDate = c.DateTime(nullable: false),
ModDate = c.DateTime(nullable: false),
ModBy = c.Int(nullable: false),
CreateBy = c.Int(nullable: false),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.InvoiceHeader", t => t.InvoiceId)
.ForeignKey("dbo.UserPayment", t => t.UserPaymentId)
.Index(t => t.InvoiceId);
现在,当我尝试运行应用程序时,它说DbContext不适合数据库。 当我创建新的迁移时 通过使用程序包管理控制台 通过命令添加迁移测试 我得到下一个代码
CreateTable(
"dbo.InvoiceCompensations",
c => new
{
Id = c.Int(nullable: false, identity: true),
InvoiceId = c.Int(nullable: false),
UserPaymentId = c.Int(nullable: false),
Billed = c.Boolean(nullable: false),
CreateDate = c.DateTime(nullable: false),
ModDate = c.DateTime(nullable: false),
ModBy = c.Int(nullable: false),
CreateBy = c.Int(nullable: false),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.InvoiceHeader", t => t.InvoiceId)
.ForeignKey("dbo.UserPayment", t => t.UserPaymentId)
.Index(t => t.InvoiceId)
.Index(t => t.UserPaymentId);
我想做什么:
没有帮助,我在Google中也没有找到任何帮助。 DBContext有2行: 公共虚拟DbSet InvoiceCompensations {get;组; } modelBuilder.Entity()。ToTable(“ InvoiceCompensations”);