A complete, hands-on, and easy to digest program that gets you from zero to building production-ready APIs in just a few weeks
Why Learn ASP.NET Core Web API?
Why should you invest your time and money into this program?
Ever since .NET Core 1.0 was introduced, the whole .NET ecosystem seems to have been given a new life. The framework was revitalized and now with the version 3, it has become a force to be reckoned with.
Not many technologies have achieved this level of polish, stability, maturity and speed. Creating a flexible yet stable technology is quite a feat, and that’s exactly what ASP.NET Core developers have achieved.
On top of that, REST APIs have become a defacto standard in the industry because of their ability to decouple backend and frontend parts of the application and the ability to serve thousands of clients simultaniously.
With every new version of the framework, it becomes even more popular so there is no time like now to hop on the bandwagon and start adding ASP.NET Core Web API to your skillset.
Moreover…
If you’ve already mastered C# and OOP concepts, this is the next logical step. If you want to learn ins and outs of web development, data modeling, persistance, security, optimization… through simple and down to earth approach…
Then this is the right book and program for you.
TABLE OF CONTENTS
1 Project Configuration
1.1 Creating a New Project
1.2 launchSettings.json File Configuration
1.3 Program.cs and Startup.cs Explanations
1.4 Extension Methods and CORS Configuration
1.5 IIS Configuration
1.6 Additional Code in the Startup Class
1.7 Environment-Based Settings
2 Configuring a Logging Service
2.1 Creating the Required Projects
2.2 Creating the ILoggerManager Interface and Installing NLog
2.3 Implementing the Interface and Nlog.Config File
2.4 Configuring Logger Service for Logging Messages
2.5 DI, IoC, and Logger Service Testing
3 Database Model and Repository Pattern
3.1 Creating Models
3.2 Context Class and the Database Connection
3.3 Migration and Initial Data Seed
3.4 Repository Pattern Logic
3.5 Repository User Interfaces and Classes
3.6 Creating a Repository Manager
4 Handling GET Requests
4.1 Controllers and Routing in WEB API
4.2 Naming Our Resources
4.3 Getting All Companies From the Database
4.4 Testing the Result with Postman
4.5 DTO Classes vs. Entity Model Classes
4.6 Using AutoMapper in ASP.NET Core
5 Global Error Handling
5.1 Handling Errors Globally with the Built-In Middleware
5.2 Startup Class Modification
5.3 Testing the Result
6 Getting Additional Resources
6.1 Getting a Single Resource From the Database
6.2 Parent/Child Relationships in Web API
6.3 Getting a Single Employee for Company
7 Content Negotiation
7.1 What Do We Get Out of the Box?
7.2 Changing the Default Configuration of Our Project
7.3 Testing Content Negotiation
7.4 Restricting Media Types
7.5 More About Formatters
7.6 Implementing a Custom Formatter
8 Method Safety and Method Idempotency
9 Creating Resources
9.1 Handling POST Requests
9.2 Code Explanation
9.3 Creating a Child Resource
9.4 Creating Children Resources Together with a Parent
9.5 Creating a Collection of Resources
9.6 Model Binding in API
10 Working with DELETE Requests
10.1 Deleting a Parent Resource with its Children
11 Working with PUT Requests
11.1 Updating Employee
11.1.1 About the Update Method from the RepositoryBase Class
11.2 Inserting Resources while Updating One
12 Working With PATCH Requests
12.1 Applying PATCH to the Employee Entity
13 Validation
13.1 Validation while Creating Resource
13.1.1 Validating Int Type
13.2 Validation for PUT Requests
13.3 Validation for PATCH Requests
14 Asynchronous Code
14.1 What is Asynchronous Programming?
14.2 Async, Await Keywords, and Return Types
14.2.1 The IRepositoryBase Interface and the RepositoryBase Class Explanation
14.3 Modifying the ICompanyRepository Interface and the CompanyRepository Class
14.4 IRepositoryManager and RepositoryManager Changes
14.5 Controller Modification
15 Action Filters
15.1 Action Filters Implementation
15.2 The Scope of Action Filters
15.3 Order of Invocation
15.4 Improving the Code with Action Filters
15.5 Validation with Action Filters
15.6 Dependency Injection in Action Filters
16 Paging
16.1 What is Paging?
16.2 Paging Implementation
16.3 Concrete Query
16.4 Improving the Solution
17 Filtering
17.1 What is Filtering?
17.2 How is Filtering Different from Searching?
17.3 How to Implement Filtering in ASP.NET Core Web API
17.4 Sending and Testing a Query
18 Searching
18.1 What is Searching?
18.2 Implementing Searching in Our Application
18.3 Testing Our Implementation
19 Sorting
19.1 What is Sorting?
19.2 How to Implement Sorting in ASP.NET Core Web API
19.3 Implementation – Step by Step
19.4 Testing Our Implementation
19.5 Improving the Sorting Functionality
20 Data Shaping
20.1 What is Data Shaping?
20.2 How to Implement Data Shaping
20.3 Step-by-Step Implementation
20.4 Resolving XML Serialization Problems
21 Supporting HATEOAS
21.1 What is HATEOAS and Why is it so Important?
21.1.1 Typical Response with HATEOAS Implemented
21.1.2 What is a Link?
21.1.3 Pros/Cons of Implementing HATEOAS
21.2 Adding Links in the Project
21.3 Additional Project Changes
21.4 Adding Custom Media Types
21.4.1 Registering Custom Media Types
21.4.2 Implementing a Media Type Validation Filter
21.5 Implementing HATEOAS
22 Working with OPTIONS and HEAD Requests
22.1 OPTIONS HTTP Request
22.2 OPTIONS Implementation
22.3 Head HTTP Request
22.4 HEAD Implementation
23 Root Document
23.1 Root Document Implementation
24 Versioning APIs
24.1 Required Package Installation and Configuration
24.2 Versioning Examples
24.2.1 Using Query String
24.2.2 Using URL Versioning
24.2.3 HTTP Header Versioning
24.2.4 Deprecating Versions
24.2.5 Using Conventions
25 Caching
25.1 About Caching
25.1.1 Cache Types
25.1.2 Response Cache Attribute
25.2 Adding Cache Headers
25.3 Adding Cache-Store
25.4 Expiration Model
25.5 Validation Model
25.6 Supporting Validation
25.6.1 Configuration
25.7 Using ETag and Validation
26 Rate Limiting and Throttling
26.1 Implementing Rate Limiting
27 JWT and Identity
27.1 Implementing Identity in ASP.NET Core Project
27.2 Creating Tables and Inserting Roles
27.3 User Creation
27.4 Big Picture
27.5 About JWT
27.6 JWT Configuration
27.7 Protecting Endpoints
27.8 Implementing Authentication
27.9 Role-Based Authorization
28 Documenting API with Swagger
28.1 About Swagger
28.2 Swagger Integration Into Our Project
28.3 Adding Authorization Support
28.4 Extending Swagger Configuration
29 Deployment to IIS
29.1 Creating Publish Files
29.2 Windows Server Hosting Bundle
29.3 Installing IIS
29.4 Configuring Environment File
29.5 Testing Deployed Application