From de4c0d390c5f4ea1884c2427345e8f8134411e13 Mon Sep 17 00:00:00 2001 From: Kevin Matsubara Date: Fri, 4 Apr 2025 17:21:24 +0200 Subject: [PATCH] Update README. --- README.md | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1e03eec..35158f7 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,48 @@ adding to an existing solution: `dotnet sln add Data/Data.csproj` +### Entity Framework commands + +Create a migration, inside of the Console project, referring to the Data project: + +`dotnet ef migrations add InitialMigration --startup-project ./ --project ../EntityFrameworkCore.Data` + + +## Links + +* [Entity Framework - Database providers](https://learn.microsoft.com/en-us/ef/core/providers/?tabs=dotnet-core-cli) ## Terms A **database-context** is an abstraction of the database structure in code. * It lists the models and their database table names. * It instantiates a database connection during the runtime of the application. -* Allows configurations to be made in code. \ No newline at end of file +* Allows configurations to be made in code. + +The **migrations** provide a version-controlled method to maintain the state of the database. +* It is possible to track when, and by who changes were made. +* In the Up method, it is described which changes should be made. +* in the Down method, it is described which changes should be undone. This allows rollback. +* There is a history table that is kept by default to track migrations. + +## Installed NuGet packages + +A list of installed NuGet packages in this application. + +Note that the [Microsoft.EntityFrameworkCore.Tools](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Tools/9.0.3) is used for Powershell commands used in the Package Manager Console for Visual Studio and that [Microsoft.EntityFrameworkCore.Design](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Design/9.0.3) is used for cross-platform command tools. + +### Console project + +[Microsoft.EntityFrameworkCore.Tools](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Tools/9.0.3) + +* `dotnet add package Microsoft.EntityFrameworkCore.Tools --version 9.0.3` + +### Data project + +[Microsoft.EntityFrameworkCore](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore/9.0.3) + +* `dotnet add package Microsoft.EntityFrameworkCore --version 9.0.3` + +[Microsoft.EntityFrameworkCore.Sqlite](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Sqlite/9.0.3) + +* `dotnet add package Microsoft.EntityFrameworkCore.Sqlite --version 9.0.3`