C
C#4mo ago
rado

✅ Can someone help me with asp.core

i want to add databases but it have been very difulcult for me
59 Replies
Pobiega
Pobiega4mo ago
Adding a database to ASP.NET Core? What connection approach are you using? EF Core, SqlConnection or Dapper? also, what database are you using
rado
rado4mo ago
uhm i dont reaaly know beacuse i am new, i have downloaded EntityFramework, Microsoft.EntityFramework.Core and Microsoft.EntityFramework.SqlDerver Server*
Pobiega
Pobiega4mo ago
okay that was a bit much 😛 there are actually two different versions of EF: EF6 and EFCore if you are using ASP.NET Core, you want to be using EF Core so you can remove both EntityFramework and Microsoft.EntityFramework.SqlServer
rado
rado4mo ago
okay, does it matter what version are they
Pobiega
Pobiega4mo ago
yes you want the latest version that matches your .NET version so if you are using .NET 8, you want EF Core 8.x
rado
rado4mo ago
i use 4.7 and i cant use anything newer idk why
Angius
Angius4mo ago
"Can't use" as in you're forbidden by someone, or as in you can't find a way to make anything newer?
rado
rado4mo ago
cant find a way
Angius
Angius4mo ago
$newproject
MODiX
MODiX4mo ago
When creating a new project, prefer using .NET over .NET Framework, unless you have a very specific reason to be using .NET Framework. .NET Framework is now legacy code and only get security fix updates, it no longer gets new features and is not recommended. https://cdn.discordapp.com/attachments/569261465463160900/899381236617855016/unknown.png
Angius
Angius4mo ago
This is the way Avoid the (.NET Framework) options Make sure VS is up to date, too And that it has the web workload installed Then, you'll be able to create something that's not a living fossil
Ulgamon
Ulgamon4mo ago
Do you have sql server and sql server management studio installed?
rado
rado4mo ago
no
Ulgamon
Ulgamon4mo ago
That's the first step
Angius
Angius4mo ago
No, the first step is to make a project in a supported version of the framework Second step is to pick some database And it does not have to be MSSQL
rado
rado4mo ago
the project taht i work on is a website that stores notes in json file but i want to save it in databases
Angius
Angius4mo ago
Ah, so the project is already made, in 4.7? If so, then my sincere condolences And I won't be of much help, then, I'm not much of an archaeologist
rado
rado4mo ago
so what do i have to download except Microsoft.EntityFramework.Core
Angius
Angius4mo ago
Not Core Your project is too old for Core You need the old Microsoft.EntityFramework
rado
rado4mo ago
only that
Angius
Angius4mo ago
Far as what you need to connect to a database goes? Yes
rado
rado4mo ago
so can you help me with the c#
Angius
Angius4mo ago
I can't. I never worked with the old EF, or with the old ASP, and I'm afraid I have no desire to either Someone else maybe
rado
rado4mo ago
so if i start it over what should i use for website with databases
Angius
Angius4mo ago
ASP.NET Core 8 It will have EF Core installed by default
rado
rado4mo ago
No description
Angius
Angius4mo ago
Razor Pages or Model-View-Controller, whichever you prefer If you're used to the ancient ASP, then MVC will probably be more familiar
rado
rado4mo ago
what are the difference between both
Angius
Angius4mo ago
Razor Pages are, generally, easier The model and controller are merged into one And the view is right next to it So there's no folder-hopping
rado
rado4mo ago
No description
rado
rado4mo ago
do i need to check add docker
Angius
Angius4mo ago
No
rado
rado4mo ago
so what packages i need to install on the new project
Angius
Angius4mo ago
None, it should just work
rado
rado4mo ago
the databases will work without packages?
Angius
Angius4mo ago
The package is installed Check the dependencies, ef core should be there
rado
rado4mo ago
oh thanks, you are very helpful should i look into analyzers or frameworks
Angius
Angius4mo ago
Any specific ones, or in general? In general, yes, it's useful knowledge
rado
rado4mo ago
okay
Ulgamon
Ulgamon4mo ago
So basically Entity Framework is an Object-Relational mapper in which you use code instead of writing SQL Queries and does much more You now need some database server installed on your machine that Entity Framework supports MySQL, SQL Server, Postgresql
Pobiega
Pobiega4mo ago
Highly recommend SQLite for playing around with, and going to Postgres when you are ready for the real thing avoid MySQL like the plague
Ulgamon
Ulgamon4mo ago
Yeah better advice
rado
rado4mo ago
but i code the logics on c# for the json file and i want to switch it to databases so that the site can have working profile atribute
rado
rado4mo ago
No description
rado
rado4mo ago
can someone help me tih this error
Pobiega
Pobiega4mo ago
do yourself a favor and don't use SQLEXPRESS sqlite or postgres are the way to go or at the very least a proper mssql instance in docker
rado
rado4mo ago
i dont know how to setup sqllite
Pobiega
Pobiega4mo ago
thats the thing - there is no setup thats why its so nice
rado
rado4mo ago
CodeWithGopi
YouTube
ASP.NET Core Razor Pages Full CRUD - .NET 7.0 Razor Pages using Ent...
#aspnetmvc #dotnetcore #codewithgopi ASP.NET Core Razor Pages Full CRUD - .NET 7.0 Razor Pages using Entity Framework Core and SQL Server In this video, we are going to create an ASP.NET Razor Pages Full CRUD Operations application using Entity Framework Core Code First approach and SQL Server. We will be usin7.0 .NET 6 Razor Pages template in...
rado
rado4mo ago
is this video worth it
Pobiega
Pobiega4mo ago
how would I know without watching it? and no, I'm not watching it :p
rado
rado4mo ago
so do you know a good tutorial for sqllite
Pobiega
Pobiega4mo ago
you dont need one just follow that, or the official EF Core tutorial but just change the connectionstring and the database provider extension method you use. thats it no other changes needed
Angius
Angius4mo ago
Here's the first Google result for efcore sqlite: https://learn.microsoft.com/en-us/ef/core/get-started/overview/first-app as it happens, it's also the MS docs
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
rado
rado4mo ago
No description
rado
rado4mo ago
can someone guide me what do i have to type for the server
Pobiega
Pobiega4mo ago
a sqlite connectionstring looks like "Data Source=filename.db"
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View