Lesson 15: Get Data From Database Using the Entity Framework in Minimal Web APIs
In this lesson you connect your Minimal Web APIs to a SQL Server database using the Entity Framework to read a database table.
Content
Lesson Objectives 00:00
DEMO: Install the Entity Framework into your Project 00:26
DEMO: Add Data Annotations to Product Class 02:03
DEMO: Create DbContext Class and Add Connection String 04:34
DEMO: Add DbContext Class to Services Container 07:13
DEMO: Get Products from the SQL Server Table 08:54
DEMO: Get a Single Product from the SQL Server Table 10:12
Method Injection 11:15
DEMO: Using Method Injection 11:51
Lesson Summary 13:31
You can get all the samples and hands-on labs for this course at https://www.pdsa.com/YouTube.
If you are interested in generating Minimal Web API projects, check out my FREE PDSC Developer Utilities at https://www.pdsa.com/Utilities.
Useful Links
Check out my article on Data Annotations at https://codemag.com/Article/2301031/T....
Microsoft's list of Data Annotation Attributes: https://learn.microsoft.com/en-us/dot....
#minimalwebapi #webapi #entityframework #ef #sqlserver #database #data #csharp #development #programming #dotnet #dotnetcore #dotnet6 #dotnet7 #dotnet8 #pauldsheriff #pluralsight #youtube
Paul.About()
Hello, my name is Paul D. Sheriff and I have a passion for teaching. I have been training developers for over 35 years through books, videos, article, blog posts, and international conferences and user groups.
Paul.Contact()
Website: https://www.pdsa.com
Email: [email protected]
LinkedIn: / paulsheriff
Blog: https://blogs.pdsa.com/
Pluralsight: https://app.pluralsight.com/profile/a...
YouTube Channel: @pauldsheriff