From 11e86ef33e2d6c2b710e7cd9064b9a51f2f55e1e Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 6 May 2021 20:38:38 +0300 Subject: Updated README with information about changing the database you use --- ExamTemplate/Web/Startup.cs | 2 +- README.md | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ExamTemplate/Web/Startup.cs b/ExamTemplate/Web/Startup.cs index d6635b8..e66e40a 100644 --- a/ExamTemplate/Web/Startup.cs +++ b/ExamTemplate/Web/Startup.cs @@ -24,7 +24,7 @@ namespace Web // Database configuration services.AddDbContext(options => - options.UseNpgsql(this.Configuration.GetConnectionString("LocalDBConnection"))); + options.UseNpgsql(this.Configuration.GetConnectionString("LocalDBConnection"))); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/README.md b/README.md index a7c82f7..5aa109c 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,26 @@ A template that could be useful for the final IT-kariera exam in 2021 ## Notes -There are some configs that I've made that you may want to revert. This section explains them. +There are some configs that I've made that you may want to change. This section explains them. + +### PostgreSQL + +The project is made to use [PostgreSQL](https://www.postgresql.org/). Since not everyone would want to use that, here are some steps for other databases. + +Using MySQL: +1. Install the [MySql.Data.EntityFrameworkCore](https://www.nuget.org/packages/MySql.Data.EntityFrameworkCore/) NuGet package in **both** `ExamTemplate/Web` and `ExamTemplate/Data` +2. In the `ConfigureServices` method, inside `ExamTemplate/Web/Startup.cs`, **and** in the `CreateDbContext` method, inside `ExamTemplate/Data/TemplateContextFactory.cs` change `UseNpgsql` to `UseMySQL` + - You'll also need to add a using for the package in step 1 + +Using SQL Server (MSSQL): +1. 1. Install the [Microsoft.EntityFrameworkCore.SqlServer](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.SqlServer/) NuGet package in **both** `ExamTemplate/Web` and `ExamTemplate/Data` +2. In the `ConfigureServices` method, inside `ExamTemplate/Web/Startup.cs`, **and** in the `CreateDbContext` method, inside `ExamTemplate/Data/TemplateContextFactory.cs` change `UseNpgsql` to `UseSqlServer` + - You'll also need to add a using for the package in step 1 + ### Disabled HTTPS Disabled, since certificates could cause issues on some systems. To revert: 1. Add `app.UseHttpsRedirection();` in the `Configure` method, inside `ExamTemplate/Web/Startup.cs` 2. Add `https://localhost:5001;` in `"applicationUrl"` in the `Web` section, inside `ExamTemplate/Web/Properties/launchSettings.json`. - So, line 21 in the `launchSettings.json` file should look like: `"applicationUrl": "https://localhost:5001;http://localhost:5000",` + - So, line 21 in the `launchSettings.json` file should look like: `"applicationUrl": "https://localhost:5001;http://localhost:5000",` -- cgit v1.2.3