C
C#14mo ago
caique

❔ 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?
No description
No description
10 Replies
Pobiega
Pobiega14mo ago
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 required
jcotton42
jcotton4214mo ago
also, do you have to use database-first? I see you're trying to scaffold
caique
caiqueOP14mo ago
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
Pobiega
Pobiega14mo ago
DB first is very rare
caique
caiqueOP14mo ago
i noticed that, i couldn't find much contents about DB first is it a bad practice?
Pobiega
Pobiega14mo ago
you only really use it if you already have a DB with data you do NOT use db first for a new project
caique
caiqueOP14mo ago
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
Pobiega
Pobiega14mo ago
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
caique
caiqueOP14mo ago
right, i'll take your advice but surely im gonna try DB first this time, thx for your help
Accord
Accord14mo ago
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.
Want results from more Discord servers?
Add your server