Entity Framework 6 Tutorial: Learn Entity Framework 6 from Scratch

Programming with Mosh · 530K views · 2017 · 27:57

Open on YouTube

Databases & storageSoftware practice, open source & careerstutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering beginner questions about getting Entity Framework and SQL Server working, especially code-first setup and migrations.

Recommended by 2 people across 2 different months, 2018 to 2021.

What it is

A 28-minute beginner tutorial by Mosh Hamedani introducing Entity Framework 6 for storing and querying data in .NET apps. It explains what EF is, compares the database-first and code-first workflows with live demos in Visual Studio, and ends with advice on choosing between them.

What people said

Strong rec Satashree Roy · 2021-07 · Stack Overflow · on “Data not getting added to LocalDB using Entity Framework in Visual Studio 19”

Turns out my project was not connecting to the SQL server and creating any database table. My bad, but learnt how to do it properly now. Great video for those starting out with SQL server and Entity Framework [LINK] [this video] Also, in my VS 19 .NET desktop development the App.config file is not created automatically. No problem, just create it from Add New Item. (Not sure what all needs to be added but for now just the connectionString item works.)

Recommends Jeffrey Rennie · 2019-04 · Stack Overflow · on “How to dynamically add and remove table rows and add/update them to the database?”

As you observed, the function addHourRow adds data to a data structure (I can't see what kind) in the browser's page state, but doesn't do anything to change the data at its source, in your database. To update the database, you'll need to add a request handler to a controller [LINK] , and call the controller from your javascript code. This video tutorial of Entity Framework may be useful: [this video]

Cites A. Marques · 2018-10 · Stack Overflow · on “How to Enable migrations on Visual Studio? Getting an exception when running enable-migrations command”

I was following a tutorial for code first which is in this link: [this video] I was trying to mix this and a demo for REST API to both things. My connection string is the one below: <ConnectionString> <add name="RestApiDemo.Models.ProductsDbContext" connectionString=" data source=localhost; initial catalog=RestApiDemo; integrated security=SSPI" providerName="System.Data.SqlClient" ></add> </ConnectionString> When I run the command enable-migrations in the console it generates the migration folder and file correctly but then I get an exception. This doesn't let me work with Code First despite having generated the file correctly. The exception is the following: Exception screenshot [LINK] Migration