@@ -314,9 +314,15 @@ public static void SeedDatabase(AirVinylDbContext context)
314314 new DoorManufacturer { Name = "Ikea" } ,
315315 new DoorManufacturer { Name = "Hardwood" }
316316 ) ;
317+ context . DoorKnobs . AddRange (
318+ new DoorKnob { Style = "Circular" } ,
319+ new DoorKnob { Style = "Lever" }
320+ ) ;
321+
317322 context . SaveChanges ( ) ;
318323
319324 ICollection < DoorManufacturer > doorManufacturers = [ .. context . DoorManufacturers ] ;
325+ ICollection < DoorKnob > doorKnobs = [ .. context . DoorKnobs ] ;
320326
321327 context . RecordStores . AddRange (
322328 new SpecializedRecordStore ( )
@@ -335,8 +341,8 @@ public static void SeedDatabase(AirVinylDbContext context)
335341 RoomNumbers = [ 3 , 4 , 5 , 6 ] ,
336342 Doors =
337343 [
338- new ( ) { Name = "Front Door" , DoorManufacturerId = doorManufacturers . Single ( m => m . Name == "Serta" ) . Id } ,
339- new ( ) { Name = "Side Door" , DoorManufacturerId = doorManufacturers . Single ( m => m . Name == "Hardwood" ) . Id }
344+ new ( ) { Name = "Front Door" , DoorManufacturerId = doorManufacturers . Single ( m => m . Name == "Serta" ) . Id , DoorKnobId = doorKnobs . Single ( k => k . Style == "Circular" ) . Id } ,
345+ new ( ) { Name = "Side Door" , DoorManufacturerId = doorManufacturers . Single ( m => m . Name == "Hardwood" ) . Id , DoorKnobId = doorKnobs . Single ( k => k . Style == "Lever" ) . Id }
340346 ]
341347 }
342348 } ,
@@ -356,8 +362,8 @@ public static void SeedDatabase(AirVinylDbContext context)
356362 RoomNumbers = [ 2 , 3 , 4 , 5 ] ,
357363 Doors =
358364 [
359- new ( ) { Name = "Main Door" , DoorManufacturerId = doorManufacturers . Single ( m => m . Name == "Serta" ) . Id } ,
360- new ( ) { Name = "Cabinet Door" , DoorManufacturerId = doorManufacturers . Single ( m => m . Name == "Serta" ) . Id }
365+ new ( ) { Name = "Main Door" , DoorManufacturerId = doorManufacturers . Single ( m => m . Name == "Serta" ) . Id , DoorKnobId = doorKnobs . Single ( k => k . Style == "Circular" ) . Id } ,
366+ new ( ) { Name = "Cabinet Door" , DoorManufacturerId = doorManufacturers . Single ( m => m . Name == "Serta" ) . Id , DoorKnobId = doorKnobs . Single ( k => k . Style == "Circular" ) . Id }
361367 ]
362368 }
363369 } ,
@@ -376,8 +382,8 @@ public static void SeedDatabase(AirVinylDbContext context)
376382 RoomNumbers = [ 1 , 2 , 3 , 4 ] ,
377383 Doors =
378384 [
379- new ( ) { Name = "Bedroom Door" , DoorManufacturerId = doorManufacturers . Single ( m => m . Name == "Serta" ) . Id } ,
380- new ( ) { Name = "Balcony Door" , DoorManufacturerId = doorManufacturers . Single ( m => m . Name == "Sealy" ) . Id }
385+ new ( ) { Name = "Bedroom Door" , DoorManufacturerId = doorManufacturers . Single ( m => m . Name == "Serta" ) . Id , DoorKnobId = doorKnobs . Single ( k => k . Style == "Circular" ) . Id } ,
386+ new ( ) { Name = "Balcony Door" , DoorManufacturerId = doorManufacturers . Single ( m => m . Name == "Sealy" ) . Id , DoorKnobId = doorKnobs . Single ( k => k . Style == "Lever" ) . Id }
381387 ]
382388 }
383389 }
0 commit comments