I am using EntityFramework 6.0 code first framework, and keep getting the following error when trying to 'update-database.'
Introducing FOREIGN KEY constraint 'FK_dbo.RateTowers_dbo.DimensionValues_DimensionValueId' on table 'RateTowers' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
I have also included the following code in my DB Context class
protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Dimension>().HasMany(dim =>
dim.DimensionValues).
WithRequired().
WillCascadeOnDelete(false);
modelBuilder.Entity<Dimension>().HasMany(dim =>
dim.RateTowers).
WithRequired().
WillCascadeOnDelete(false);
modelBuilder.Entity<Dimension>().HasMany(dim =>
dim.DimensionValues).
WithRequired().
WillCascadeOnDelete(false);
}
I have attached a screen shot of my data model Data Model