From 8a529bb02488a9e0ac8db2742225227ffc615511 Mon Sep 17 00:00:00 2001 From: ahmetfarukulu Date: Thu, 5 Dec 2024 15:15:37 +0300 Subject: [PATCH] Add Db Migrator documentation and navigation links in layered web application guide --- .../layered-web-application/db-migrator.md | 41 +++++++++++++++++++ .../web-applications.md | 14 +++++++ 2 files changed, 55 insertions(+) create mode 100644 docs/en/solution-templates/layered-web-application/db-migrator.md diff --git a/docs/en/solution-templates/layered-web-application/db-migrator.md b/docs/en/solution-templates/layered-web-application/db-migrator.md new file mode 100644 index 0000000000..50fd38d836 --- /dev/null +++ b/docs/en/solution-templates/layered-web-application/db-migrator.md @@ -0,0 +1,41 @@ +# Layered Solution: Db Migrator + +````json +//[doc-nav] +{ + "Previous": { + "Name": "Web Applications", + "Path": "solution-templates/layered-web-application/web-applications" + }, + "Next": { + "Name": "Mobile Applications", + "Path": "solution-templates/layered-web-application/mobile-applications" + } +} +```` + +## Db Migrator Project + +The Db Migrator project is a console application designed to handle database schema migrations and seed data population. It operates as a standalone application that can be executed on-demand or integrated into a CI/CD pipeline. + +### Usage + +You can run the Db Migrator application: +- From the command line. +- Directly from Visual Studio. + +### Configuration + +The Db Migrator project maintains its own configuration, separate from the main application. If you need to update the database connection string or any related settings, ensure that changes are applied consistently to both the main application and the Db Migrator to avoid discrepancies. + +## Folder Structure + +In the `*.DbMigrator` project, you will find the `DbMigratorHostedService` class, which is responsible for executing database migrations and seeding data. This class is registered in the `Program` class and starts running when the application is launched. + +### Layers and Responsibilities + +- **`*.Domain` Layer**: + Contains the `Data` folder, which holds the necessary classes for managing database migrations and seed data. However, since the `*.Domain` layer does not reference the `EntityFrameworkCore` package, it only defines the abstraction for data migration. + +- **`*.EntityFrameworkCore` Layer**: + This layer is responsible for implementing database schema migrations. It includes the `EntityFrameworkCore[ProjectName]DbSchemaMigrator` class, which handles the actual migration logic using the `EntityFrameworkCore` package. diff --git a/docs/en/solution-templates/layered-web-application/web-applications.md b/docs/en/solution-templates/layered-web-application/web-applications.md index 8820daecc2..5754572bfb 100644 --- a/docs/en/solution-templates/layered-web-application/web-applications.md +++ b/docs/en/solution-templates/layered-web-application/web-applications.md @@ -1,5 +1,19 @@ # Layered Solution: Web Applications +````json +//[doc-nav] +{ + "Previous": { + "Name": "Main Components", + "Path": "solution-templates/layered-web-application/main-components" + }, + "Next": { + "Name": "Db Migrator", + "Path": "solution-templates/layered-web-application/db-migrator" + } +} +```` + The web applications are the main user interfaces of the solution. They are the entry points for users to interact with the system. The Layered Solution Template supports the following web applications: - **MVC / Razor Pages**: This is an ASP.NET Core MVC application. It is a traditional web application that serves HTML pages to users and is suitable for building web applications with server-side rendering.