✅ Can someone help me with asp.core
i want to add databases but it have been very difulcult for me
59 Replies
Adding a database to ASP.NET Core? What connection approach are you using? EF Core, SqlConnection or Dapper?
also, what database are you using
uhm i dont reaaly know beacuse i am new, i have downloaded EntityFramework, Microsoft.EntityFramework.Core and Microsoft.EntityFramework.SqlDerver
Server*
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
okay, does it matter what version are they
yes
you want the latest version that matches your .NET version
so if you are using .NET 8, you want EF Core 8.x
i use 4.7 and i cant use anything newer idk why
"Can't use" as in you're forbidden by someone, or as in you can't find a way to make anything newer?
cant find a way
$newproject
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
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 fossilDo you have sql server and sql server management studio installed?
no
That's the first step
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
the project taht i work on is a website that stores notes in json file but i want to save it in databases
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
so what do i have to download except Microsoft.EntityFramework.Core
Not Core
Your project is too old for Core
You need the old
Microsoft.EntityFramework
only that
Far as what you need to connect to a database goes? Yes
so can you help me with the c#
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
so if i start it over what should i use for website with databases
ASP.NET Core 8
It will have EF Core installed by default
Razor Pages or Model-View-Controller, whichever you prefer
If you're used to the ancient ASP, then MVC will probably be more familiar
what are the difference between both
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
do i need to check add docker
No
so what packages i need to install on the new project
None, it should just work
the databases will work without packages?
The package is installed
Check the dependencies, ef core should be there
oh thanks, you are very helpful
should i look into analyzers or frameworks
Any specific ones, or in general?
In general, yes, it's useful knowledge
okay
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
Highly recommend SQLite for playing around with, and going to Postgres when you are ready for the real thing
avoid MySQL like the plague
Yeah better advice
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
can someone help me tih this error
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
i dont know how to setup sqllite
thats the thing - there is no setup
thats why its so nice
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...
is this video worth it
how would I know without watching it?
and no, I'm not watching it :p
so do you know a good tutorial for sqllite
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
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 docsUnknown User•10mo ago
Message Not Public
Sign In & Join Server To View
can someone guide me what do i have to type for the server
a sqlite connectionstring looks like
"Data Source=filename.db"
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View