用code first映射数据库报错
Introducing FOREIGN KEY constraint 'FK_dbo.Roles_dbo.SubSystems_SubSystemID' on table 'Roles' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Could not create constraint. See previous errors.
查看数据库中设置的外键
解决方案:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<SubSystem>().hasMany(i=>i.Roles).WithRequired().WillCascadeOnDelete(false);
}