Add Coach configuration and link coach IDs to Teams.

This commit is contained in:
Kevin Matsubara 2025-04-07 11:55:27 +02:00
parent ab6b9b1b2a
commit 4d486114cb
2 changed files with 45 additions and 15 deletions

View File

@ -0,0 +1,30 @@
using EntityFrameworkCore.Domain;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace EntityFrameworkCore.Data;
public class CoachConfiguration : IEntityTypeConfiguration<Coach>
{
public void Configure(EntityTypeBuilder<Coach> builder)
{
builder.HasData(
// Use hardcoded dates, not dynamic data such as new DateTimeOffset.UtcNow.DateTime for seeding.
new Coach { Id = 1, Name = "Christian Southgate", CreatedDate = new DateTime(2025, 4, 7, 17, 7, 27, 33) },
new Coach { Id = 2, Name = "Rob Mann", CreatedDate = new DateTime(2025, 4, 7, 17, 7, 27, 33) },
new Coach { Id = 3, Name = "Jon Curtis", CreatedDate = new DateTime(2025, 4, 7, 17, 7, 27, 33) },
new Coach { Id = 4, Name = "Andy Taylor", CreatedDate = new DateTime(2025, 4, 7, 17, 7, 27, 33) },
new Coach { Id = 5, Name = "Steve Johnson", CreatedDate = new DateTime(2025, 4, 7, 17, 7, 27, 33) },
new Coach { Id = 6, Name = "Dan Cook", CreatedDate = new DateTime(2025, 4, 7, 17, 7, 27, 33) },
new Coach { Id = 7, Name = "Ken Jarvis", CreatedDate = new DateTime(2025, 4, 7, 17, 7, 27, 33) },
new Coach { Id = 8, Name = "Kenny Suzuki", CreatedDate = new DateTime(2025, 4, 7, 17, 7, 27, 33) },
new Coach { Id = 9, Name = "Gordon Hall", CreatedDate = new DateTime(2025, 4, 7, 17, 7, 27, 33) },
new Coach { Id = 10, Name = "John O Dowd", CreatedDate = new DateTime(2025, 4, 7, 17, 7, 27, 33) },
new Coach { Id = 11, Name = "Julian Widdows", CreatedDate = new DateTime(2025, 4, 7, 17, 7, 27, 33) },
new Coach { Id = 12, Name = "Andy Williams", CreatedDate = new DateTime(2025, 4, 7, 17, 7, 27, 33) },
new Coach { Id = 13, Name = "Trevor Williams", CreatedDate = new DateTime(2025, 4, 7, 17, 7, 27, 33) },
new Coach { Id = 14, Name = "Blake Deathray", CreatedDate = new DateTime(2025, 4, 7, 17, 7, 27, 33) },
new Coach { Id = 15, Name = "Rock Housebrick", CreatedDate = new DateTime(2025, 4, 7, 17, 7, 27, 33) }
);
}
}

View File

@ -24,21 +24,21 @@ public class TeamConfiguration : IEntityTypeConfiguration<Team>
builder.HasData( builder.HasData(
// Use hardcoded dates, not dynamic data such as new DateTimeOffset.UtcNow.DateTime for seeding. // Use hardcoded dates, not dynamic data such as new DateTimeOffset.UtcNow.DateTime for seeding.
new Team { Id = 1, Name = "Neo Delhi", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 2 }, new Team { Id = 1, Name = "Neo Delhi", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 2, CoachId = 1 },
new Team { Id = 2, Name = "Voodoo", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 1 }, new Team { Id = 2, Name = "Voodoo", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 1, CoachId = 2 },
new Team { Id = 3, Name = "Penal X", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 1 }, new Team { Id = 3, Name = "Penal X", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 1, CoachId = 3 },
new Team { Id = 4, Name = "Neo Tokyo", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 3 }, new Team { Id = 4, Name = "Neo Tokyo", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 3, CoachId = 4 },
new Team { Id = 5, Name = "Neo Barcelona", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 2 }, new Team { Id = 5, Name = "Neo Barcelona", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 2, CoachId = 5 },
new Team { Id = 6, Name = "Neo Manchester", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 2 }, new Team { Id = 6, Name = "Neo Manchester", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 2, CoachId = 6 },
new Team { Id = 7, Name = "Neo Bangkok", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 3 }, new Team { Id = 7, Name = "Neo Bangkok", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 3, CoachId = 7 },
new Team { Id = 8, Name = "Neo Amsterdam", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 3 }, new Team { Id = 8, Name = "Neo Amsterdam", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 3, CoachId = 8 },
new Team { Id = 9, Name = "Killaklowns", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 1 }, new Team { Id = 9, Name = "Killaklowns", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 1, CoachId = 9 },
new Team { Id = 10, Name = "Sol", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 1 }, new Team { Id = 10, Name = "Sol", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 1, CoachId = 10 },
new Team { Id = 11, Name = "DEC", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 4 }, new Team { Id = 11, Name = "DEC", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 4, CoachId = 11 },
new Team { Id = 12, Name = "Leopards", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 1 }, new Team { Id = 12, Name = "Leopards", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 1, CoachId = 12 },
new Team { Id = 13, Name = "Harlequins", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 1 }, new Team { Id = 13, Name = "Harlequins", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 1, CoachId = 13 },
new Team { Id = 14, Name = "Gladiators", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 4 }, new Team { Id = 14, Name = "Gladiators", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 4, CoachId = 14 },
new Team { Id = 15, Name = "Fiz-O", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 1 } new Team { Id = 15, Name = "Fiz-O", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33), LeagueId = 1, CoachId = 15 }
); );
} }
} }