1

I am currently trying myself in Entity Framework in C# and trying to do the registration/auth with Identity. I was following this guide (3:38) but when came the migration part I've got some issues.

The person in the guide uses a PostgreSQL server on some hosting to connect to it with a connection string

Host=;Port=;Database=;Username=;Password;

and connects to his hosting. I don't have any hosting machine and never worked with servers. How can I use (if I actually can) a connection string to create a database file right in my project directory?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Taggeddev
  • 33
  • 7

3 Answers3

3

use connetion string :

"ConnectionStrings": {
    "LocalhostConnection": "Host=127.0.0.1;Password=********;Persist Security Info=True;Username=databaseUser;Database=DatabaseName",
    "RemoteConnection": "Host=IP or Domain Address;Port=3432;Password=********;Persist Security Info=True;Username=databaseUser;Database=DatabaseName"
  },
foad abdollahi
  • 1,733
  • 14
  • 32
0

mean of the host here (in the test environment) is the database (postgreSQL) installed on your computer. As foad abdollahi said, the host address can be IP address or Domain name or etc. so first you must find your PostgreSQL info installed PC. for retrive this info can use this link:PostgreSQL database service

Majid Gholipour
  • 179
  • 1
  • 11
0

The problem was that I didn't understand how the PostgreSQL work (and not sure that I understood it actually but I found a solution)

As abdollahi commented to the question I downloaded Postgres with pgadmin4 and followed another guide

.UseNpgsql("Host=localhost;Port=5432;Database=usersdb2;Username=postgres;Password=password");

Probably not the best connection string but I am happy it works :) Thanks

Taggeddev
  • 33
  • 7