40 Commits

Author SHA1 Message Date
02d8477b05 Create migration for League soft delete flag. 2025-04-14 22:14:12 +02:00
f02538b281 Create migrations for concurrency tokens. 2025-04-14 22:11:01 +02:00
2a09ddb0da Add concurrency checks.
See also:
https://learn.microsoft.com/en-us/ef/core/saving/concurrency?tabs=data-annotations
2025-04-14 22:10:45 +02:00
feafaba447 Override ConfigureConventions to apply global restrictions on models. 2025-04-14 21:49:18 +02:00
8a4e8a41f3 Add migration for restrictions.
Note that I had to remove the view from the table manually, otherwise I could not update the database.
2025-04-14 21:30:34 +02:00
e4b92dedef Add restrictions in configuration and data annotations. 2025-04-14 21:29:56 +02:00
5b90fa1242 Override SaveChangesAsync to automatically add audit data. 2025-04-14 17:12:15 +02:00
8fc6bc96c0 Create new DbContext constructor with external Options.
And install related packages.
2025-04-14 10:50:13 +02:00
001e78736c Add example user-defined function. 2025-04-08 22:35:20 +02:00
dd195dfddf Add custom SQL to create a view for Teams and Leagues with migration.
Also state that this view is keyless.
2025-04-07 20:10:53 +02:00
b56a19d8b8 Recreate consolidation of migrations after fixes. 2025-04-07 11:58:11 +02:00
4d486114cb Add Coach configuration and link coach IDs to Teams. 2025-04-07 11:56:57 +02:00
ab6b9b1b2a Fix seeded data for Teams to have LeagueId. 2025-04-07 11:39:59 +02:00
8229e74c13 Remove consolidated migration.
dotnet ef migrations remove --startup-project ./ --project ../EntityFrameworkCore.Data
2025-04-07 11:36:19 +02:00
150f500675 Consolidate relationship migrations into single migration.
This is due to an error rising, another error is rising at this point when trying to update the database:
SQLite Error 19: 'NOT NULL constraint failed: Teams.LeagueId'.
2025-04-07 11:33:49 +02:00
0cacdd7b33 Add migration one to one Coach to Team relationship. 2025-04-07 11:22:05 +02:00
1813bf6362 Add migration for many to many relationships between Matches and Teams. 2025-04-07 11:11:46 +02:00
804943486f Add relationship and foreign key configurations between Match and Team. 2025-04-07 11:09:42 +02:00
42edf6cccf Add migration to make relation League to Team nullable. 2025-04-07 10:45:09 +02:00
1230476b27 Add migration to add relationship between League and Team. 2025-04-07 10:43:29 +02:00
e863015075 Add migration to add Team ID to Coach. 2025-04-07 10:17:02 +02:00
f630dfac2c Add migration for seeded leagues. 2025-04-06 21:07:11 +02:00
7f5ecb9d3a Add Configurations for Teams and Leagues. 2025-04-06 21:06:59 +02:00
fd915cc972 Add migration to add Name to League. 2025-04-06 20:32:41 +02:00
1a8cafbc4a Add migration to remove TeamID. 2025-04-06 20:10:59 +02:00
f137595a5a Add migration to add Match and League entities. 2025-04-06 20:06:01 +02:00
a49717ff49 Update snapshot to make properties nullable. 2025-04-06 19:59:45 +02:00
2477d2b080 Create new domain models for Match and League. 2025-04-06 11:34:53 +02:00
ba3c65d7a1 Move Id to BaseDomainModel and replace TeamId with regular Id. 2025-04-06 11:27:13 +02:00
1aae643a78 Add example query with tracking disabled.
This can also be done globally, see context file.
2025-04-05 21:29:48 +02:00
25ede5cc28 Add logging to Entity Framework Core workload. 2025-04-04 20:12:03 +02:00
6e0167a051 Seed database with Teams. 2025-04-04 19:36:19 +02:00
451fb50cd8 Add comment to DbContext about where the database file is created. 2025-04-04 17:58:59 +02:00
5b3c661b67 Create initial migration.
deadballzone/EntityFrameworkCore.Console(master)$
dotnet ef migrations add InitialMigration --startup-project ./ --project ../EntityFrameworkCore.Data
2025-04-04 17:28:08 +02:00
a8b59a8ca2 Create DbContext file. 2025-04-04 17:21:16 +02:00
f58f92d0e0 Install Sqlite database provider for Entity Framework in Data project. 2025-04-04 17:20:57 +02:00
601aff07c1 Add reference to Domain for the Data project.
Note that this command, did not work in Ubuntu. I just added the html to the project file myself.

dotnet reference add

https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-reference-add
2025-04-04 16:25:46 +02:00
c8b1f5c391 Create a clean solution and move all files.
dotnet new sln -n deadballzone
2025-04-04 16:06:58 +02:00
3db3e262e1 Install Entity Framework Core NuGet package in Data project instead of solution.
dotnet remove package Microsoft.EntityFrameworkCore
cd EntityFrameworkCore.Data/
dotnet add package Microsoft.EntityFrameworkCore --version 9.0.3
2025-04-04 15:57:34 +02:00
62ae17f271 Create empty class libraries Data and Domain and add to solution.
dotnet new web
dotnet new classlib -o EntityFrameworkCore.Data
dotnet new classlib -o EntityFrameworkCore.Domain
dotnet sln add EntityFrameworkCore.Data/EntityFrameworkCore.Data.csproj
dotnet sln add EntityFrameworkCore.Domain/EntityFrameworkCore.Domain.csproj
2025-04-04 14:47:31 +02:00