我正在使用EF 4.3迁移功能来创建数据库迁移脚本。 当我运行Add-转移命令生成的脚本创建为这样:EntityFramework迁移cascadeDelete参数
CreateTable(
"dbo.Recipients",
c => new
{
RecipientID = c.String(nullable: false, maxLength: 128),
SurveyRoundID = c.String(nullable: false, maxLength: 128),
LastUpdatedAt = c.DateTime(),
})
.PrimaryKey(t => t.RecipientID)
.ForeignKey("dbo.Employees", t => t.EmployeeID, cascadeDelete: true)
.ForeignKey("dbo.SurveyRounds", t => t.SurveyRoundID, cascadeDelete: true)
.Index(t => t.EmployeeID)
.Index(t => t.SurveyRoundID);
我的问题是,scafolding迁移选择cascadeDelete是真实的,即使实体收件人不属于关系的高手。
现在我手动将cascadeDelete参数更改为false,但我想知道为什么它默认选择true。
谢谢, 伊多。
您是否知道如何在迁移中不使用含有'Sql(..)'的DDL定义'ON DELETE SET NULL'? – JoeBrockhaus 2015-07-22 22:51:03