✅ Need help connecting to SQL Database on .NET
I have already installed the EF Core module.
30 Replies
What have you tried?
Ive tried looking up videos online that would show me how to do it but every video im seeing has a different answer and none of the answers seem to be something that would work for me
Right now I just have a database schema set up with information already in it
i would not use videos for programming tutorials, they tend to be pretty poor
$helloef
Getting Started - EF Core
Getting started tutorial for Entity Framework Core
Ohhh i see
Hey so from what im reading
since i already have a database set up with all the schemas
I have to reverse engineer or use scaffolding?
that's called "db first," and yes that's typically what you would do in that situation
gotcha
and one more question
this is a project with a group but im the one setting up the database
Is this anything like node.js where they can just clone the project and then run npm install to get all the packages
or will they have to install everything as i did like the tools and then the EF core module and all that
your nuget refs are in the csproj and will be restored when they open the project
as for the ef tools, how did you install them?
Im on VSCode so what i did is dotnet add package Microsoft.EntityFrameworkCore.SqlServer
in the terminal
Microsoft.EntityFrameworkCore.Tools or dotnet tool install?
ah, vscode
and i assume you did the global install?
dotnet tool install --global
?Hmm im not sure but i know i didnt do the global install
I only did
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
dotnet add package Microsoft.EntityFrameworkCore.Design
I might be missing one
those are all nuget packages, but you need
dotnet ef
if you're going to do reverse engineering
the docs tell you to globally install that, but personally i find that to stupid, frankly
is there a
.config/dotnet-tools.json
in your repo?Nah i cant find that

This is what my file setup is looking like for the backend
im following these steps rn

Ive done the first 2
still havent done the 3rd prereq
yeah, so you did global install, i would advise this instead
that will create a tool manifest and record the version of dotnet-ef you're using in it
then, anyone that clones your repo can use
dotnet tool restore
and get the exact tools you were usingOhhh i see awesome
it also means that different projects on your computer can use different versions of dotnet-ef if needed, which is not possible if you install it globally
i have no idea why the docs tell you to use global tools for ef, it's silly
global tools don't even save space over local, regardless of how you install there's still just one copy per tool version
So i should just avoid using global
ill stick with what u sent here in that case

for ef, yes
some tools make sense to be globally installed, but dotnet-ef is not one of them
awesome
I just need to do the 3rd prereq now
So the thing is my friend has the database set up on microsoft azure or something like that
but im able to connect to it from (DBeaver)
using just the server name, username, and password
Would i be able to connect to it similarly in .NET? Or would i need more information
you would use the same connection information
Okk thank you so much
youve been extremely helpful
🙂
$close btw
If you have no further questions, please use /close to mark the forum thread as answered