.NET Core 3.1 Web API & Entity Framework Core Jumpstart

.NET Core 3.1 Web API & Entity Framework Core Jumpstart

English | MP4 | AVC 1280×720 | AAC 48KHz 2ch | 5 Hours | 2.16 GB

Build the back-end of a .NET Core 3.1 web application with Web API, Entity Framework Core & SQL Server in no time!

The .NET Core framework is getting better and better and more important in the web development world nowadays.

Almost every request I get for new web development projects is asking for knowledge in .NET Core, including Web API and Entity Framework Core.

So, knowing the fundamentals of back end web development with .NET Core can be highly beneficial to your career. And that’s where this course comes in.

In a short period of time, you will learn how to set up a Web API, make restful calls to this Web API and also save data persistently with Entity Framework Core, Code-First Migration, a SQL Server & SQLite database, and all three types of relationships in this database.

We will get right to the point, you will see every single step of writing the necessary code and by the end of this course, you will have what it takes to say ‘yes’ to all the .NET Core project requests from any recruiter.

The only tools you need in the beginning are Visual Studio Code and Postman – both are available for free.

We will use Visual Studio Code for our implementations and Postman to make calls to the Web API. Both tools are available for Windows, Mac OS, and Linux. And since .NET Core is cross-platform, you can follow this course on any of these operating systems. (I know, Microsoft and cross-platform, it still surprises me, too.)

Later, we will also utilize SQL Server Express and the SQL Server Management Studio to manage our database. These are also available for free.

By the end of this course, we will also have a look at how to configure the web application to use a SQLite database and also seed data for that database.

The back end application we’re going to build is a small text-based role-playing game where different users can register (we’re going to use JSON web tokens for authentication) and create their own characters like a mage or a knight, add some skills and a weapon, and also let the characters fight against each other to see who is the best of them all.

What You Will Learn

  • Introduction
  • Create your first Web API call in less than 10 minutes
  • Initialize a Git repository for your source control

Web API Core

  • The Model-View-Controller (MVC) pattern
  • Create models and controllers
  • Attribute routing (with parameters)
  • The HTTP request methods GET, POST, PUT & DELETE
  • Best practices for your Web API like a ServiceResponse class and Data-Transfer-Objects (DTOs)
  • Map your models with AutoMapper

Entity Framework Core

  • Object-Relational-Mapping
  • Code-First Migration
  • SQL Server Express
  • How to use a DataContext and a proper ConnectionString
  • All previous HTTP requests with Entity Framework Core to save your data in a SQL Server & SQLite database
  • Data Seeding: Insert data with a migration programmatically

Authentication

  • Token Authentication with JSON Web Tokens
  • Claims
  • Secure controllers with the Authorize attribute
  • Add roles to the users

Advanced Relationships with Entity Framework Core

  • One-to-one relationships
  • One-to-many relationships
  • Many-to-many relationships
  • Include entities with Entity Framework Core
  • Get the proper relations between entities

More Than Just CRUD

  • Start automatic fights
  • Filter and order RPG characters by their highscore

What you’ll learn

  • Build a complete .NET Core 3.1 back-end with Web API, Entity Framework Core, SQL Server & SQLite
  • Implement Token Authentication with JSON Web Tokens & Roles
  • Utilize all three types of relationships in your database: one-to-one, one-to-many, many-to-many
  • Use the HTTP request methods GET, POST, PUT & DELETE
  • Implement best practices that are used in the real world like a proper structure for your Web API, Dependency Injection, asynchronous calls with async/await and Data-Transfer-Objects (DTOs)
  • Use LINQ to filter, sort, map, select and access your entities.
  • Seed data with code-first migrations programmatically
Table of Contents

Introduction
1 Introduction
2 Tools (VS Code, Postman, .NET Core SDK)
3 Create a new Web API
4 First API Call
5 Git Repository & .gitignore File
6 GitHub Repository

Web API Core
7 Introduction
8 The Model-View-Controller (MVC) Pattern
9 New Models
10 New Controller & GET a New Character
11 First Steps with Attribute Routing
12 Routing with Parameters
13 HTTP Methods Explained
14 Add a New Character with POST
15 Best Practice Web API Structure
16 Character Service
17 Asynchronous Calls
18 Proper Service Response with Generics
19 Data-Transfer-Objects (DTOs)
20 AutoMapper
21 Modify a Character with PUT
22 Delete a Character
23 Summary

Entity Framework Core
24 Introduction
25 Object-Relational-Mapping & Code-First Migration Explained
26 Installing Entity Framework Core
27 Installing SQL Server Express (with Management Studio)
28 Implementing the DataContext
29 ConnectionString & Adding the DbContext
30 First Migration
31 GET Implementations
32 POST Implementations
33 PUT Implementations
34 DELETE Implementations
35 Summary

Authentication
36 Introduction
37 The User Model
38 First Relation
39 Authentication Theory
40 Authentication Repository
41 User Registration
42 “User already exists.”
43 Authentication Controller
44 User Login
45 Token Authentication with JSON Web Tokens
46 JSON Web Tokens (JWT) preparations
47 JSON Web Tokens (JWT) implementations
48 Authorize Attribute
49 Read Claims & Get the User’s RPG Characters
50 Summary

Advanced Relationships with Entity Framework Core
51 Introduction
52 Proper User-Character Relation
53 Include Entities with Entity Framework
54 One-To-One Relation with Weapons
55 Add Weapons to RPG Characters
56 Many-To-Many Relation with Skills
57 Add Skills to RPG Characters
58 Summary

Let The Games Begin (More Than Just CRUD)
59 Introduction
60 Prepare to Fight!
61 Attack with Weapons
62 Attack with Skills
63 Start a Fight
64 Highscore Sort & Filter Entities
65 Summary

Bonus Role-Based Authentication
66 Introduction
67 New User Property Role & A New Migration
68 Extend the JSON Web Token with another Claim
69 Restrict Controller Access & Change Service Behavior

Bonus SQLite & Data Seeding
70 Introduction
71 New Package, ConnectionString & Configuration
72 Create the SQLite Database
73 Use the DB Browser for SQLite
74 Data Seeding Preparations
75 Seeding Skills
76 Seeding Entities with Relations