99 Commits

Author SHA1 Message Date
30d69e9f79 Create query filter for soft delete on League and add an example function. 2025-04-14 22:24:46 +02:00
02d8477b05 Create migration for League soft delete flag. 2025-04-14 22:14:12 +02:00
bcb084d733 Add soft delete flag to League model. 2025-04-14 22:13:48 +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
f6d5733992 Add example with transaction security with save points. 2025-04-14 21:49:44 +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
d67d05d6a2 Use DbContext with options. 2025-04-14 16:54:50 +02:00
cbcfb5536d Improve get Team by Id and include Coach and League.
Also add IgnoreCycles to options to prevent recursive problem.
2025-04-14 13:15:53 +02:00
30c3621deb Return TeamDto instead of Team model for API. 2025-04-14 13:03:30 +02:00
f8d1ddd758 Map controllers to program.cs file.
http://localhost:5072/api/teams
2025-04-14 12:52:02 +02:00
4176958f17 Remove Weatherforecast example code. 2025-04-14 12:50:30 +02:00
2934b45018 Optimise delete code with only 1 trip to database. 2025-04-14 11:57:59 +02:00
16ddb2d336 Scaffold TeamsController in API project.
dotnet aspnet-codegenerator controller -name TeamsController -async -api -m Team -dc DeadBallZoneLeagueDbContext -outDir Controllers -dbProvider sqlite
2025-04-14 11:44:22 +02:00
8fc6bc96c0 Create new DbContext constructor with external Options.
And install related packages.
2025-04-14 10:50:13 +02:00
ba77fbd176 Update README with ASP.NET info. 2025-04-08 23:03:37 +02:00
56fd0e44e7 Add API project to solution.
dotnet sln add EntityFrameworkCore.API/EntityFrameworkCore.API.csproj
2025-04-08 22:53:03 +02:00
73187855ba Create new ASP.NET API project.
dotnet new webapi -o EntityFrameworkCore.API
2025-04-08 22:51:12 +02:00
1c48a8c9c9 Add note about JOINs in SQL queries. 2025-04-08 22:37:56 +02:00
001e78736c Add example user-defined function. 2025-04-08 22:35:20 +02:00
093c663b31 Add example scalar query. 2025-04-08 22:24:28 +02:00
99edd6c536 Add raw SQL examples. 2025-04-08 22:17:23 +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
9da28603c1 Add example function to project entity data into a DTO. 2025-04-07 19:03:52 +02:00
fd6e601489 Update README with loading types. 2025-04-07 16:57:44 +02:00
fc9d89ae97 Add example filter function and insert matches. 2025-04-07 16:57:31 +02:00
3652a69730 Add example Explicit Loading function. 2025-04-07 14:02:25 +02:00
8103c682cf Add example Eager Loading function. 2025-04-07 13:50:57 +02:00
64965c3fef Update League model with initialized empty Teams list and no longer be nullable. 2025-04-07 13:50:41 +02:00
6dcf07e90e Add example function inserting relational data objects. 2025-04-07 13:31:11 +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
b0e653ab0d Add one to one relationship between Coach and Team.
A Coach is parent, Team is child.
A Coach can exist on his own, without a Team, but a Team cannot play without a Coach.
2025-04-07 11:21:48 +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
c73a72204d Update README with relationships. 2025-04-07 10:53:03 +02:00
42edf6cccf Add migration to make relation League to Team nullable. 2025-04-07 10:45:09 +02:00
e852f09f09 Make relation of League to Team nullable. 2025-04-07 10:44:41 +02:00
1230476b27 Add migration to add relationship between League and Team. 2025-04-07 10:43:29 +02:00
a0733b4ebb Add relationship between League and Team. 2025-04-07 10:43:14 +02:00
b1f99dc57a Ensure database created on startup. 2025-04-07 10:22:05 +02:00
e863015075 Add migration to add Team ID to Coach. 2025-04-07 10:17:02 +02:00
48afe784d6 Add TeamId to Coach model. 2025-04-07 10:16:41 +02:00