C
C#10mo 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
Pobiega10mo 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
radoOP10mo ago
uhm i dont reaaly know beacuse i am new, i have downloaded EntityFramework, Microsoft.EntityFramework.Core and Microsoft.EntityFramework.SqlDerver Server*
Pobiega
Pobiega10mo 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
radoOP10mo ago
okay, does it matter what version are they
Pobiega
Pobiega10mo 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
radoOP10mo ago
i use 4.7 and i cant use anything newer idk why
Angius
Angius10mo 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
radoOP10mo ago
cant find a way
Angius
Angius10mo ago
$newproject
MODiX
MODiX10mo 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
Angius10mo 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
Ulgamon10mo ago
Do you have sql server and sql server management studio installed?
rado
radoOP10mo ago
no
Ulgamon
Ulgamon10mo ago
That's the first step
Angius
Angius10mo 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
radoOP10mo 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
Angius10mo 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
radoOP10mo ago
so what do i have to download except Microsoft.EntityFramework.Core
Angius
Angius10mo ago
Not Core Your project is too old for Core You need the old Microsoft.EntityFramework
rado
radoOP10mo ago
only that
Angius
Angius10mo ago
Far as what you need to connect to a database goes? Yes
rado
radoOP10mo ago
so can you help me with the c#
Angius
Angius10mo 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
radoOP10mo ago
so if i start it over what should i use for website with databases
Angius
Angius10mo ago
ASP.NET Core 8 It will have EF Core installed by default
rado
radoOP10mo ago
No description
Angius
Angius10mo 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
radoOP10mo ago
what are the difference between both
Angius
Angius10mo 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
radoOP10mo ago
No description
rado
radoOP10mo ago
do i need to check add docker
Angius
Angius10mo ago
No
rado
radoOP10mo ago
so what packages i need to install on the new project
Angius
Angius10mo ago
None, it should just work
rado
radoOP10mo ago
the databases will work without packages?
Angius
Angius10mo ago
The package is installed Check the dependencies, ef core should be there
rado
radoOP10mo ago
oh thanks, you are very helpful should i look into analyzers or frameworks
Angius
Angius10mo ago
Any specific ones, or in general? In general, yes, it's useful knowledge
rado
radoOP10mo ago
okay
Ulgamon
Ulgamon10mo 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
Pobiega10mo 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
Ulgamon10mo ago
Yeah better advice
rado
radoOP10mo 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
radoOP10mo ago
No description
rado
radoOP10mo ago
can someone help me tih this error
Pobiega
Pobiega10mo 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
radoOP10mo ago
i dont know how to setup sqllite
Pobiega
Pobiega10mo ago
thats the thing - there is no setup thats why its so nice
rado
radoOP10mo 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
radoOP10mo ago
is this video worth it
Pobiega
Pobiega10mo ago
how would I know without watching it? and no, I'm not watching it :p
rado
radoOP10mo ago
so do you know a good tutorial for sqllite
Pobiega
Pobiega10mo 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
Angius10mo 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 User10mo ago
Message Not Public
Sign In & Join Server To View
rado
radoOP10mo ago
No description
rado
radoOP10mo ago
can someone guide me what do i have to type for the server
Pobiega
Pobiega10mo ago
a sqlite connectionstring looks like "Data Source=filename.db"
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server