Dotnet
Authentication and Authorization - Registration Part 2

Add Connection String

PRO

I finished! On to the next chapter

Outline

Demo: Add Connection String

In the Conduit.Api Project modify appsettings.json file

Add a new JSON Node
  • Name the new node: ConnectionStrings
Add a JSON Sub-Node to ConnectionStrings
  • Name the the node: DefaultConnection
  • (Sql Server) Set the value to: "Server=(localdb)\mssqllocaldb;Database=Conduit;Trusted_Connection=True;MultipleActiveResultSets=True"
  • (Sqlite) Set the Value to: "DataSource=conduit.db;Cache=Shared"
  • Postgres
  • mySql

Here's what the appsettings.json file should look like:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=Conduit;Trusted_Connection=True;MultipleActiveResultSets=True"
  },
  "AppSettings": {
    "Token": "AGqYc764pBTpIa4eLpPBAqb68SJ6NVZagNE0H967JyuDWH7frEHGHCAXQ9rDOBB"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*"
}