❔ Difficulty to find PostgreSQL data source to connect with database by EFCore.
I'm trying to use EFCore to connect my database to my code, but i cant find the data source of my PostgreSQL
First image is a guy on SQLServer
Second Image is me trying the same on PostgreSQL
There is a way to get the data source?
10 Replies
oh boi
connectionstrings are not interchangable per database
in that screenshot on the left, he is using SQL Express which has a wildly different connstr than postgres
are you running postgres on the same computer as you are running visual studio on?
generally, npgsql uses this format:
Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=myPassword;
thats the localhost IP and default port, change database/username/password as requiredalso, do you have to use database-first?
I see you're trying to scaffold
got it, but the procedure would be the same, right? to scaffold
yes
oh i see now, i'll try that
well, i would like to since it's already created
it is a bad thing?
at least the tutorial i was checking on was by database-first
DB first is very rare
i noticed that, i couldn't find much contents about DB first
is it a bad practice?
you only really use it if you already have a DB with data
you do NOT use db first for a new project
i already have a db with data, but is only for studying, do you recommend in this case that i dont use db first?
because i could just delete the DB
and recreate it
by EFCORE
its up to you
code first is good to learn
as its what you'll likely be doing if you ever do this for real
right, i'll take your advice but surely im gonna try DB first this time, thx for your help
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.