From 65f58b98a8d2e17ee6d507feec11a5c6612156b8 Mon Sep 17 00:00:00 2001 From: Praburaj Date: Tue, 2 Dec 2014 11:29:49 -0800 Subject: [PATCH] Fixing the test failure On introducing a FK relationship from OrderDetails table to Album table with album id creates a problem when deleting an album that's checked out atleast once. --- src/MusicStore/Models/MusicStoreContext.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/MusicStore/Models/MusicStoreContext.cs b/src/MusicStore/Models/MusicStoreContext.cs index 58a6ec2281..63e5e05f67 100644 --- a/src/MusicStore/Models/MusicStoreContext.cs +++ b/src/MusicStore/Models/MusicStoreContext.cs @@ -33,7 +33,9 @@ namespace MusicStore.Models builder.Entity().ManyToOne(a => a.Artist); builder.Entity().ManyToOne(a => a.Genre, g => g.Albums); builder.Entity().OneToMany(o => o.OrderDetails); - builder.Entity().OneToMany(a => a.OrderDetails, od => od.Album); + + //Deleting an album fails with this relation + //builder.Entity().OneToMany(a => a.OrderDetails, od => od.Album); base.OnModelCreating(builder); }