First code migration ignores DatabaseGeneratedOption?
I tried to change the field to a calculated field.
That is, from:
Property(c=>c.IsPaid)
.IsRequired();
in
Property(c=>c.IsPaid)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Computed)
.IsRequired();
Then after adding the migration:
Add-Migration IsPaidAsComputed
With forest migration, I got the migration class:
public partial class IsPaidAsComputed : DbMigration
{
public override void Up()
{
AlterColumn("dbo.Citations", "IsPaid", c => c.Boolean(nullable: false));
}
public override void Down()
{
AlterColumn("dbo.Citations", "IsPaid", c => c.Boolean(nullable: false));
}
}
Is the Entity Framework smart enough to determine what an intentional change is?
What's the correct way AlterColumn
to enter a calculated field?
+3
source to share
No one has answered this question yet
Check out similar questions: