Compare commits
14 Commits
10d207cb44
...
b114a696a0
| Author | SHA1 | Date | |
|---|---|---|---|
| b114a696a0 | |||
| f630dfac2c | |||
| 7f5ecb9d3a | |||
| fd915cc972 | |||
| 808a6d6a3e | |||
| 1a8cafbc4a | |||
| 278064b19b | |||
| f137595a5a | |||
| a49717ff49 | |||
| cccd9ba8e0 | |||
| 63a09998ac | |||
| 4175eea10c | |||
| 2477d2b080 | |||
| ba3c65d7a1 |
@ -4,10 +4,10 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using var context = new DeadBallZoneLeagueDbContext();
|
||||
|
||||
// var teamOne = await context.Teams.FirstAsync(t => t.TeamId == 1);
|
||||
// var teamTwo = await context.Teams.FirstAsync(t => t.TeamId == 2);
|
||||
// var teamThree = await context.Teams.SingleAsync(t => t.TeamId == 3);
|
||||
// var teamFour = await context.Teams.SingleOrDefaultAsync(t => t.TeamId == 3);
|
||||
// var teamOne = await context.Teams.FirstAsync(t => t.Id == 1);
|
||||
// var teamTwo = await context.Teams.FirstAsync(t => t.Id == 2);
|
||||
// var teamThree = await context.Teams.SingleAsync(t => t.Id == 3);
|
||||
// var teamFour = await context.Teams.SingleOrDefaultAsync(t => t.Id == 3);
|
||||
|
||||
// There is no entry for coaches yet, this function will provide a null to coach.
|
||||
// Rather than raise: "System.InvalidOperationException: Sequence contains no elements."
|
||||
@ -86,7 +86,7 @@ async Task ListVSIQueryableCall()
|
||||
teamsAsList = await context.Teams.ToListAsync();
|
||||
if (option == 1)
|
||||
{
|
||||
teamsAsList = teamsAsList.Where(t => t.TeamId == 1).ToList();
|
||||
teamsAsList = teamsAsList.Where(t => t.Id == 1).ToList();
|
||||
}
|
||||
else if (option == 2)
|
||||
{
|
||||
@ -101,7 +101,7 @@ async Task ListVSIQueryableCall()
|
||||
var teamsAsQueryable = context.Teams.AsQueryable();
|
||||
if (option == 1)
|
||||
{
|
||||
teamsAsQueryable = teamsAsQueryable.Where(t => t.TeamId == 1);
|
||||
teamsAsQueryable = teamsAsQueryable.Where(t => t.Id == 1);
|
||||
}
|
||||
else if (option == 2)
|
||||
{
|
||||
@ -170,7 +170,7 @@ async Task GroupedTeams()
|
||||
foreach (var groupedTeam in groupedTeams)
|
||||
{
|
||||
Console.WriteLine(groupedTeam.Key);
|
||||
Console.WriteLine(groupedTeam.Sum(t => t.TeamId));
|
||||
Console.WriteLine(groupedTeam.Sum(t => t.Id));
|
||||
foreach (var team in groupedTeam)
|
||||
{
|
||||
Console.WriteLine(team.Name);
|
||||
@ -180,19 +180,19 @@ async Task GroupedTeams()
|
||||
|
||||
async Task CountFunctionsTeams(int id)
|
||||
{
|
||||
var numberOfTeams = await context.Teams.CountAsync(t => t.TeamId > id);
|
||||
var numberOfTeams = await context.Teams.CountAsync(t => t.Id > id);
|
||||
Console.WriteLine($"Number of teams with ID > {id}: {numberOfTeams}");
|
||||
|
||||
var maxTeams = await context.Teams.MaxAsync(t => t.TeamId);
|
||||
var maxTeams = await context.Teams.MaxAsync(t => t.Id);
|
||||
Console.WriteLine($"Max teams: {maxTeams}");
|
||||
|
||||
var minTeams = await context.Teams.MinAsync(t => t.TeamId);
|
||||
var minTeams = await context.Teams.MinAsync(t => t.Id);
|
||||
Console.WriteLine($"Min teams: {minTeams}");
|
||||
|
||||
var averageTeams = await context.Teams.AverageAsync(t => t.TeamId);
|
||||
var averageTeams = await context.Teams.AverageAsync(t => t.Id);
|
||||
Console.WriteLine($"Average teams: {averageTeams}");
|
||||
|
||||
var sumTeams = await context.Teams.SumAsync(t => t.TeamId);
|
||||
var sumTeams = await context.Teams.SumAsync(t => t.Id);
|
||||
Console.WriteLine($"Sum team IDs: {sumTeams}");
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
using EntityFrameworkCore.Domain;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace EntityFrameworkCore.Data;
|
||||
|
||||
public class LeagueConfiguration : IEntityTypeConfiguration<League>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<League> builder)
|
||||
{
|
||||
builder.HasData(
|
||||
new League { Id = 1, Name = "Local League", CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33)},
|
||||
new League { Id = 2, Name = "National League", CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33)},
|
||||
new League { Id = 3, Name = "Geosphere", CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33)},
|
||||
new League { Id = 4, Name = "Cyber war", CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33)}
|
||||
);
|
||||
}
|
||||
}
|
||||
30
EntityFrameworkCore.Data/Configurations/TeamConfiguration.cs
Normal file
30
EntityFrameworkCore.Data/Configurations/TeamConfiguration.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using EntityFrameworkCore.Domain;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace EntityFrameworkCore.Data;
|
||||
|
||||
public class TeamConfiguration : IEntityTypeConfiguration<Team>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Team> builder)
|
||||
{
|
||||
builder.HasData(
|
||||
// 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)},
|
||||
new Team { Id = 2, Name = "Voodoo", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { Id = 3, Name = "Penal X", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { Id = 4, Name = "Neo Tokyo", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { Id = 5, Name = "Neo Barcelona", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { Id = 6, Name = "Neo Manchester", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { Id = 7, Name = "Neo Bangkok", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { Id = 8, Name = "Neo Amsterdam", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { Id = 9, Name = "Killaklowns", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { Id = 10, Name = "Sol", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { Id = 11, Name = "DEC", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { Id = 12, Name = "Leopards", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { Id = 13, Name = "Harlequins", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { Id = 14, Name = "Gladiators", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { Id = 15, Name = "Fiz-O", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) }
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
using EntityFrameworkCore.Domain;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Reflection;
|
||||
|
||||
namespace EntityFrameworkCore.Data;
|
||||
|
||||
@ -17,6 +18,8 @@ public class DeadBallZoneLeagueDbContext : DbContext
|
||||
}
|
||||
public DbSet<Team> Teams { get; set; }
|
||||
public DbSet<Coach> Coaches { get; set; }
|
||||
public DbSet<League> Leagues { get; set; }
|
||||
public DbSet<Match> Matches { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
@ -29,23 +32,10 @@ public class DeadBallZoneLeagueDbContext : DbContext
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Team>().HasData(
|
||||
// Use hardcoded dates, not dynamic data such as new DateTimeOffset.UtcNow.DateTime for seeding.
|
||||
new Team { TeamId = 1, Name = "Neo Delhi", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33)},
|
||||
new Team { TeamId = 2, Name = "Voodoo", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { TeamId = 3, Name = "Penal X", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { TeamId = 4, Name = "Neo Tokyo", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { TeamId = 5, Name = "Neo Barcelona", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { TeamId = 6, Name = "Neo Manchester", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { TeamId = 7, Name = "Neo Bangkok", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { TeamId = 8, Name = "Neo Amsterdam", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { TeamId = 9, Name = "Killaklowns", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { TeamId = 10, Name = "Sol", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { TeamId = 11, Name = "DEC", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { TeamId = 12, Name = "Leopards", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { TeamId = 13, Name = "Harlequins", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { TeamId = 14, Name = "Gladiators", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) },
|
||||
new Team { TeamId = 15, Name = "Fiz-O", CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33) }
|
||||
);
|
||||
// modelBuilder.ApplyConfiguration(new TeamConfiguration());
|
||||
// modelBuilder.ApplyConfiguration(new LeagueConfiguration());
|
||||
|
||||
// This line can be used, then individual configurations do not need to be loaded.
|
||||
modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
|
||||
}
|
||||
}
|
||||
|
||||
282
EntityFrameworkCore.Data/Migrations/20250406180432_AddMatchAndLeagueEntities.Designer.cs
generated
Normal file
282
EntityFrameworkCore.Data/Migrations/20250406180432_AddMatchAndLeagueEntities.Designer.cs
generated
Normal file
@ -0,0 +1,282 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using EntityFrameworkCore.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntityFrameworkCore.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(DeadBallZoneLeagueDbContext))]
|
||||
[Migration("20250406180432_AddMatchAndLeagueEntities")]
|
||||
partial class AddMatchAndLeagueEntities
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.3");
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.Coach", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Coaches");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.League", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Leagues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.Match", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("AwayTeamId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("HomeTeamId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("TicketPrice")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Matches");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.Team", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("CoachId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("LeagueId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int?>("TeamId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Teams");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Delhi"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Voodoo"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Penal X"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Tokyo"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Barcelona"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 6,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Manchester"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 7,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Bangkok"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 8,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Amsterdam"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 9,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Killaklowns"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 10,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Sol"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 11,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "DEC"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 12,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Leopards"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 13,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Harlequins"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 14,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Gladiators"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 15,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Fiz-O"
|
||||
});
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,406 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace EntityFrameworkCore.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddMatchAndLeagueEntities : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Teams",
|
||||
table: "Teams");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "TeamId",
|
||||
keyValue: 1);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "TeamId",
|
||||
keyValue: 2);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "TeamId",
|
||||
keyValue: 3);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "TeamId",
|
||||
keyValue: 4);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "TeamId",
|
||||
keyValue: 5);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "TeamId",
|
||||
keyValue: 6);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "TeamId",
|
||||
keyValue: 7);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "TeamId",
|
||||
keyValue: 8);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "TeamId",
|
||||
keyValue: 9);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "TeamId",
|
||||
keyValue: 10);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "TeamId",
|
||||
keyValue: 11);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "TeamId",
|
||||
keyValue: 12);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "TeamId",
|
||||
keyValue: 13);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "TeamId",
|
||||
keyValue: 14);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "TeamId",
|
||||
keyValue: 15);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "TeamId",
|
||||
table: "Teams",
|
||||
type: "INTEGER",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "INTEGER")
|
||||
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Id",
|
||||
table: "Teams",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0)
|
||||
.Annotation("Sqlite:Autoincrement", true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "CoachId",
|
||||
table: "Teams",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "CreatedBy",
|
||||
table: "Teams",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "LeagueId",
|
||||
table: "Teams",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ModifiedBy",
|
||||
table: "Teams",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "ModifiedDate",
|
||||
table: "Teams",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "CreatedBy",
|
||||
table: "Coaches",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ModifiedBy",
|
||||
table: "Coaches",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "ModifiedDate",
|
||||
table: "Coaches",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Teams",
|
||||
table: "Teams",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Leagues",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
CreatedDate = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
ModifiedDate = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "TEXT", nullable: true),
|
||||
ModifiedBy = table.Column<string>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Leagues", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Matches",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
HomeTeamId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
AwayTeamId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
TicketPrice = table.Column<decimal>(type: "TEXT", nullable: false),
|
||||
Date = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
CreatedDate = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
ModifiedDate = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "TEXT", nullable: true),
|
||||
ModifiedBy = table.Column<string>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Matches", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Teams",
|
||||
columns: new[] { "Id", "CoachId", "CreatedBy", "CreatedDate", "LeagueId", "ModifiedBy", "ModifiedDate", "Name", "TeamId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, 0, null, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Neo Delhi", null },
|
||||
{ 2, 0, null, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Voodoo", null },
|
||||
{ 3, 0, null, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Penal X", null },
|
||||
{ 4, 0, null, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Neo Tokyo", null },
|
||||
{ 5, 0, null, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Neo Barcelona", null },
|
||||
{ 6, 0, null, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Neo Manchester", null },
|
||||
{ 7, 0, null, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Neo Bangkok", null },
|
||||
{ 8, 0, null, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Neo Amsterdam", null },
|
||||
{ 9, 0, null, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Killaklowns", null },
|
||||
{ 10, 0, null, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Sol", null },
|
||||
{ 11, 0, null, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "DEC", null },
|
||||
{ 12, 0, null, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Leopards", null },
|
||||
{ 13, 0, null, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Harlequins", null },
|
||||
{ 14, 0, null, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Gladiators", null },
|
||||
{ 15, 0, null, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Fiz-O", null }
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Leagues");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Matches");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Teams",
|
||||
table: "Teams");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyColumnType: "INTEGER",
|
||||
keyValue: 1);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyColumnType: "INTEGER",
|
||||
keyValue: 2);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyColumnType: "INTEGER",
|
||||
keyValue: 3);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyColumnType: "INTEGER",
|
||||
keyValue: 4);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyColumnType: "INTEGER",
|
||||
keyValue: 5);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyColumnType: "INTEGER",
|
||||
keyValue: 6);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyColumnType: "INTEGER",
|
||||
keyValue: 7);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyColumnType: "INTEGER",
|
||||
keyValue: 8);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyColumnType: "INTEGER",
|
||||
keyValue: 9);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyColumnType: "INTEGER",
|
||||
keyValue: 10);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyColumnType: "INTEGER",
|
||||
keyValue: 11);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyColumnType: "INTEGER",
|
||||
keyValue: 12);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyColumnType: "INTEGER",
|
||||
keyValue: 13);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyColumnType: "INTEGER",
|
||||
keyValue: 14);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyColumnType: "INTEGER",
|
||||
keyValue: 15);
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Id",
|
||||
table: "Teams");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CoachId",
|
||||
table: "Teams");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CreatedBy",
|
||||
table: "Teams");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LeagueId",
|
||||
table: "Teams");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ModifiedBy",
|
||||
table: "Teams");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ModifiedDate",
|
||||
table: "Teams");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CreatedBy",
|
||||
table: "Coaches");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ModifiedBy",
|
||||
table: "Coaches");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ModifiedDate",
|
||||
table: "Coaches");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "TeamId",
|
||||
table: "Teams",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "INTEGER",
|
||||
oldNullable: true)
|
||||
.Annotation("Sqlite:Autoincrement", true);
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Teams",
|
||||
table: "Teams",
|
||||
column: "TeamId");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Teams",
|
||||
columns: new[] { "TeamId", "CreatedDate", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), "Neo Delhi" },
|
||||
{ 2, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), "Voodoo" },
|
||||
{ 3, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), "Penal X" },
|
||||
{ 4, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), "Neo Tokyo" },
|
||||
{ 5, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), "Neo Barcelona" },
|
||||
{ 6, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), "Neo Manchester" },
|
||||
{ 7, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), "Neo Bangkok" },
|
||||
{ 8, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), "Neo Amsterdam" },
|
||||
{ 9, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), "Killaklowns" },
|
||||
{ 10, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), "Sol" },
|
||||
{ 11, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), "DEC" },
|
||||
{ 12, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), "Leopards" },
|
||||
{ 13, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), "Harlequins" },
|
||||
{ 14, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), "Gladiators" },
|
||||
{ 15, new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified), "Fiz-O" }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
279
EntityFrameworkCore.Data/Migrations/20250406180942_RemoveTeamId.Designer.cs
generated
Normal file
279
EntityFrameworkCore.Data/Migrations/20250406180942_RemoveTeamId.Designer.cs
generated
Normal file
@ -0,0 +1,279 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using EntityFrameworkCore.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntityFrameworkCore.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(DeadBallZoneLeagueDbContext))]
|
||||
[Migration("20250406180942_RemoveTeamId")]
|
||||
partial class RemoveTeamId
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.3");
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.Coach", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Coaches");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.League", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Leagues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.Match", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("AwayTeamId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("HomeTeamId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("TicketPrice")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Matches");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.Team", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("CoachId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("LeagueId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Teams");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Delhi"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Voodoo"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Penal X"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Tokyo"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Barcelona"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 6,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Manchester"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 7,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Bangkok"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 8,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Amsterdam"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 9,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Killaklowns"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 10,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Sol"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 11,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "DEC"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 12,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Leopards"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 13,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Harlequins"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 14,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Gladiators"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 15,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Fiz-O"
|
||||
});
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,133 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntityFrameworkCore.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RemoveTeamId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TeamId",
|
||||
table: "Teams");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "TeamId",
|
||||
table: "Teams",
|
||||
type: "INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "TeamId",
|
||||
value: null);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "TeamId",
|
||||
value: null);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "TeamId",
|
||||
value: null);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyValue: 4,
|
||||
column: "TeamId",
|
||||
value: null);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyValue: 5,
|
||||
column: "TeamId",
|
||||
value: null);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyValue: 6,
|
||||
column: "TeamId",
|
||||
value: null);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyValue: 7,
|
||||
column: "TeamId",
|
||||
value: null);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyValue: 8,
|
||||
column: "TeamId",
|
||||
value: null);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyValue: 9,
|
||||
column: "TeamId",
|
||||
value: null);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyValue: 10,
|
||||
column: "TeamId",
|
||||
value: null);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyValue: 11,
|
||||
column: "TeamId",
|
||||
value: null);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyValue: 12,
|
||||
column: "TeamId",
|
||||
value: null);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyValue: 13,
|
||||
column: "TeamId",
|
||||
value: null);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyValue: 14,
|
||||
column: "TeamId",
|
||||
value: null);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Teams",
|
||||
keyColumn: "Id",
|
||||
keyValue: 15,
|
||||
column: "TeamId",
|
||||
value: null);
|
||||
}
|
||||
}
|
||||
}
|
||||
282
EntityFrameworkCore.Data/Migrations/20250406183140_LeagueName.Designer.cs
generated
Normal file
282
EntityFrameworkCore.Data/Migrations/20250406183140_LeagueName.Designer.cs
generated
Normal file
@ -0,0 +1,282 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using EntityFrameworkCore.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntityFrameworkCore.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(DeadBallZoneLeagueDbContext))]
|
||||
[Migration("20250406183140_LeagueName")]
|
||||
partial class LeagueName
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.3");
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.Coach", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Coaches");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.League", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Leagues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.Match", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("AwayTeamId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("HomeTeamId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("TicketPrice")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Matches");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.Team", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("CoachId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("LeagueId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Teams");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Delhi"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Voodoo"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Penal X"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Tokyo"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Barcelona"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 6,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Manchester"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 7,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Bangkok"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 8,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Amsterdam"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 9,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Killaklowns"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 10,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Sol"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 11,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "DEC"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 12,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Leopards"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 13,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Harlequins"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 14,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Gladiators"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 15,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Fiz-O"
|
||||
});
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntityFrameworkCore.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class LeagueName : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Name",
|
||||
table: "Leagues",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Name",
|
||||
table: "Leagues");
|
||||
}
|
||||
}
|
||||
}
|
||||
312
EntityFrameworkCore.Data/Migrations/20250406190614_SeededLeagues.Designer.cs
generated
Normal file
312
EntityFrameworkCore.Data/Migrations/20250406190614_SeededLeagues.Designer.cs
generated
Normal file
@ -0,0 +1,312 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using EntityFrameworkCore.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntityFrameworkCore.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(DeadBallZoneLeagueDbContext))]
|
||||
[Migration("20250406190614_SeededLeagues")]
|
||||
partial class SeededLeagues
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.3");
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.Coach", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Coaches");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.League", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Leagues");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Local League"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "National League"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Geosphere"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Cyber war"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.Match", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("AwayTeamId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("HomeTeamId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("TicketPrice")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Matches");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.Team", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("CoachId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("LeagueId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Teams");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Delhi"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Voodoo"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Penal X"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Tokyo"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Barcelona"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 6,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Manchester"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 7,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Bangkok"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 8,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Amsterdam"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 9,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Killaklowns"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 10,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Sol"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 11,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "DEC"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 12,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Leopards"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 13,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Harlequins"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 14,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Gladiators"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 15,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Fiz-O"
|
||||
});
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace EntityFrameworkCore.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class SeededLeagues : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.InsertData(
|
||||
table: "Leagues",
|
||||
columns: new[] { "Id", "CreatedBy", "CreatedDate", "ModifiedBy", "ModifiedDate", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, null, new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Local League" },
|
||||
{ 2, null, new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "National League" },
|
||||
{ 3, null, new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Geosphere" },
|
||||
{ 4, null, new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Cyber war" }
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Leagues",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Leagues",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Leagues",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Leagues",
|
||||
keyColumn: "Id",
|
||||
keyValue: 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -23,9 +23,18 @@ namespace EntityFrameworkCore.Data.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
@ -35,111 +44,262 @@ namespace EntityFrameworkCore.Data.Migrations
|
||||
b.ToTable("Coaches");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.Team", b =>
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.League", b =>
|
||||
{
|
||||
b.Property<int>("TeamId")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("TeamId");
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Leagues");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Local League"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "National League"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Geosphere"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
CreatedDate = new DateTime(2025, 4, 6, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Cyber war"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.Match", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("AwayTeamId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("HomeTeamId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("TicketPrice")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Matches");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EntityFrameworkCore.Domain.Team", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("CoachId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("LeagueId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Teams");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
TeamId = 1,
|
||||
Id = 1,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Delhi"
|
||||
},
|
||||
new
|
||||
{
|
||||
TeamId = 2,
|
||||
Id = 2,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Voodoo"
|
||||
},
|
||||
new
|
||||
{
|
||||
TeamId = 3,
|
||||
Id = 3,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Penal X"
|
||||
},
|
||||
new
|
||||
{
|
||||
TeamId = 4,
|
||||
Id = 4,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Tokyo"
|
||||
},
|
||||
new
|
||||
{
|
||||
TeamId = 5,
|
||||
Id = 5,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Barcelona"
|
||||
},
|
||||
new
|
||||
{
|
||||
TeamId = 6,
|
||||
Id = 6,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Manchester"
|
||||
},
|
||||
new
|
||||
{
|
||||
TeamId = 7,
|
||||
Id = 7,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Bangkok"
|
||||
},
|
||||
new
|
||||
{
|
||||
TeamId = 8,
|
||||
Id = 8,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Neo Amsterdam"
|
||||
},
|
||||
new
|
||||
{
|
||||
TeamId = 9,
|
||||
Id = 9,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Killaklowns"
|
||||
},
|
||||
new
|
||||
{
|
||||
TeamId = 10,
|
||||
Id = 10,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Sol"
|
||||
},
|
||||
new
|
||||
{
|
||||
TeamId = 11,
|
||||
Id = 11,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "DEC"
|
||||
},
|
||||
new
|
||||
{
|
||||
TeamId = 12,
|
||||
Id = 12,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Leopards"
|
||||
},
|
||||
new
|
||||
{
|
||||
TeamId = 13,
|
||||
Id = 13,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Harlequins"
|
||||
},
|
||||
new
|
||||
{
|
||||
TeamId = 14,
|
||||
Id = 14,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Gladiators"
|
||||
},
|
||||
new
|
||||
{
|
||||
TeamId = 15,
|
||||
Id = 15,
|
||||
CoachId = 0,
|
||||
CreatedDate = new DateTime(2025, 4, 4, 17, 7, 27, 33, DateTimeKind.Unspecified),
|
||||
LeagueId = 0,
|
||||
ModifiedDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Fiz-O"
|
||||
});
|
||||
});
|
||||
|
||||
@ -2,5 +2,9 @@
|
||||
// Since C#11, you do not need to wrap in accolades anymore.
|
||||
public abstract class BaseDomainModel
|
||||
{
|
||||
public int Id { get; set; } // Anything called "Id" is automatically a Primary Key.
|
||||
public DateTime CreatedDate { get; set;}
|
||||
public DateTime ModifiedDate { get; set;}
|
||||
public string? CreatedBy { get; set; }
|
||||
public string? ModifiedBy { get; set; }
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Since C#11, you do not need to wrap in accolades anymore.
|
||||
public class Coach : BaseDomainModel
|
||||
{
|
||||
public int Id { get; set; } // Anything called "Id" is automatically a Primary Key.
|
||||
public string Name { get; set; } // Strings are automatically become VARCHAR database types.
|
||||
}
|
||||
|
||||
|
||||
6
EntityFrameworkCore.Domain/League.cs
Normal file
6
EntityFrameworkCore.Domain/League.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace EntityFrameworkCore.Domain;
|
||||
|
||||
public class League : BaseDomainModel
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
9
EntityFrameworkCore.Domain/Match.cs
Normal file
9
EntityFrameworkCore.Domain/Match.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace EntityFrameworkCore.Domain;
|
||||
|
||||
public class Match : BaseDomainModel
|
||||
{
|
||||
public int HomeTeamId { get; set; }
|
||||
public int AwayTeamId { get; set; }
|
||||
public decimal TicketPrice { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
}
|
||||
@ -2,6 +2,7 @@
|
||||
// Since C#11, you do not need to wrap in accolades anymore.
|
||||
public class Team : BaseDomainModel
|
||||
{
|
||||
public int TeamId { get; set;} // This naming convention also allows EF to see this as a PK.
|
||||
public string? Name { get; set; }
|
||||
public int LeagueId { get; set; }
|
||||
public int CoachId { get; set; }
|
||||
}
|
||||
|
||||
@ -43,6 +43,14 @@ Database-first scaffolding example: *(no need for escape slashes)*
|
||||
|
||||
Using `-force` parameter to force overrides when scaffolding.
|
||||
|
||||
Remove last migration:
|
||||
|
||||
`dotnet ef migrations remove --startup-project ./ --project ../EntityFrameworkCore.Data`
|
||||
|
||||
Create migration script (This generates SQL of all the migrations). Add the `--idempotent` parameter to make it idempotent. This applies only the changes not already made. You can also specify migration names to only generate between specific migrations.
|
||||
|
||||
`dotnet ef migrations script --startup-project ./ --project ../EntityFrameworkCore.Data`
|
||||
|
||||
## Links
|
||||
|
||||
* [Entity Framework - Database providers](https://learn.microsoft.com/en-us/ef/core/providers/?tabs=dotnet-core-cli)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user