LANCommander/LANCommander.Server.Data
Pat Hartl 3440345868 Add ability to project to another datatype in repo
This commit adds the ability for database requests to be projected to another datatype using AutoMapper. This is extremely useful for grabbing large amounts of data from the database and mapping it to another datatype without the overhead of mapping it post-query.
2024-11-11 18:18:59 -06:00
..
Enums Start of migrations, services, controllers 2024-10-31 01:54:34 -05:00
Models Start of migrations, services, controllers 2024-10-31 01:54:34 -05:00
DatabaseContext.cs Rename semaphore to mutex 2024-11-08 00:39:55 -06:00
DatabaseContextConnectionInterceptor.cs Rename identity tables 2024-10-15 20:48:06 -05:00
LANCommander.Server.Data.csproj Add ability to project to another datatype in repo 2024-11-11 18:18:59 -06:00
ModelBuilderExtensions.cs Use custom models for identities 2024-10-15 23:48:16 -05:00
README.md Rename identity tables 2024-10-15 20:48:06 -05:00
Repository.cs Add ability to project to another datatype in repo 2024-11-11 18:18:59 -06:00

LANCommander.Server.Data

This is the main assembly for defining database schema and the database context for Entity Framework Core.

Adding Migrations

Migrations should only be added to the database provider projects. The following commands can be used to add a new migration:

dotnet ef migrations add <Migration Name> --project LANCommander.Server.Data.SQLite --startup-project LANCommander.Server -- --database-provider=SQLite --connection-string="Data Source=LANCommander.db;Cache=Shared"
dotnet ef migrations add <Migration Name> --project LANCommander.Server.Data.MySQL --startup-project LANCommander.Server -- --database-provider=MySQL --connection-string="Server=localhost;Uid=root;Pwd=password;Database=LANCommander"
dotnet ef migrations add <Migration Name> --project LANCommander.Server.Data.PostgreSQL --startup-project LANCommander.Server -- --database-provider=PostgreSQL --connection-string="Host=localhost;Port=5432;Database=LANCommander;User Id=postgres;Password=password"

A migration should be added to every database provider. Note that when running each of these, Settings.yml needs to be updated with the correct connection strings.

If something with the parsing of the database provider or connection string arguments needs to be looked at, you can add --debugger for the application to wait until a debugger is attached.