
Minimal APIs in ASP.NET 9
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
- Get insights into contemporary trends and tools shaping the API industry
- Explore both basic and advanced topics such as optimization, data integration, and caching
- Purchase of the print or Kindle book includes a free PDF eBook
Book DescriptionWritten by an esteemed technology leader, a.NET specialist, and Microsoft MVP for Developer Technologies, Minimal APIs in ASP.NET 9 provides you with specialized insights into the latest advancements in.NET technology, particularly minimal APIs. You'll get your first minimal API set up and running, before exploring the anatomy of a typical minimal API project, seeing how the framework can be used to create various HTTP endpoints, route, and validate requests, as well as enhancing those requests with custom middleware. After covering the basics, you'll move on to data mapping, managing important dependencies through dependency injection and integrating your minimal APIs with data sources such as Entity Framework, Dapper, and SQL databases for creating CRUD operations. The chapters also walk you through performance optimization, asynchronous programming, and caching, which'll allow you to examine the more advanced aspects of minimal API development, with code examples reflecting real-world scenarios. By the end of this book, you'll be armed with the necessary best practices and skills needed for deploying performant, elegant, and scalable minimal APIs in.NET.What you will learn - Become proficient in minimal APIs within the.NET Core 9 framework
- Find out how to ensure scalability, performance, and maintainability
- Work with databases and ORMs, such as Entity Framework and Dapper
- Optimize minimal APIs, including asynchronous programming, caching strategies, and profiling tools
- Implement advanced features like dependency injection, request validation, data mapping, and routing techniques
- Create and configure minimal API projects effectively
Who this book is forIf you're a generalist developer looking for a fresh perspective on API development with an emphasis on minimalism, then this book is for you. Aimed at intermediate developers, this book strikes the right balance between accessibility and depth. The book assumes an intermediate level of C# and.NET knowledge, while providing sufficient guidance and explanations to help you progress confidently through the chapters.
All prices
More details
Other editions
Additional editions

Person
Nick Proud is a software engineer, technology leader, and Microsoft MVP for Developer Technologies, specializing in Robotic Process Automation and.NET. He is currently the Director of Software Engineering at NexBotix, as well as a technical content creator, producing educational video content about C# and Microsoft Azure.
Content
- Intro
- Title Page
- Copyright and Credits
- Dedication
- Contributors
- Table of Contributors
- Preface
- Part 1 - Introduction to Minimal APIs
- Chapter 1: Getting Up and Running with Minimal API Development
- Technical requirements
- Understanding minimal APIs
- Contrasting minimal APIs with traditional API approaches
- The significance of minimal APIs in modern development
- Installing required tools and dependencies
- Installing Visual Studio for Windows
- Installing Visual Studio Code for Mac and Linux
- Configuring development environments
- Creating a project in Visual Studio
- Creating a project in Visual Studio Code
- Summary
- Chapter 2: Creating Your First Minimal API
- Technical requirements
- Project structure and organization
- Endpoints
- Models
- Routes
- Defining endpoints and routes
- GET methods
- POST methods
- PUT methods
- PATCH methods
- DELETE method
- Building the employee management API
- Creating the API
- Creating the first endpoint
- Handling HTTP requests
- Summary
- Chapter 3: The Anatomy of a Minimal API
- Anatomy of a minimal API
- Components of a minimal API application
- The API request lifecycle
- Summary
- Part 2 - Data and Execution Flow
- Chapter 4: Handling HTTP Methods and Routing
- Technical requirements
- Handling requests
- Defining endpoints in the Todo API
- Getting todo items
- Creating Todo items
- Updating existing Todo items
- Managing route parameters
- Request validation and error handling
- Manual validation
- Validation with data annotations and model binding
- Summary
- Chapter 5: The Middleware Pipeline
- Technical requirements
- An introduction to middleware
- Configuring middleware pipelines
- Middleware classes
- Inline middleware
- Implementing custom middleware
- Terminal middleware
- Handling errors within the middleware pipeline
- Summary
- Chapter 6: Parameter Binding
- Parameter binding sources
- Route values
- Query strings
- Optional query string parameters
- Headers
- Strongly typed object binding
- Form values
- Explicit binding with attributes
- Binding parameters through dependency injection
- Binding precedence
- Creating custom binding logic
- Summary
- Chapter 7: Dependency Injection in Minimal APIs
- Understanding DI
- The DI container
- The case for DI
- Configuring DI in minimal APIs
- Setting up a scoped DI project
- Creating a singleton DI project
- DI best practices
- Avoiding the service locator pattern
- Registering services with an extension method
- Using sensible service lifetimes
- Summary
- Chapter 8: Integrating Minimal APIs with Data Sources
- Technical requirements
- Understanding data integration in minimal APIs
- Connecting to and integrating with SQL databases
- Configuring the connection to the database and retrieving records
- Inserting Employee records
- Executing database transactions from API endpoints
- Connecting to MongoDB
- Summary
- Chapter 9: Object Relational Mapping with Entity Framework Core and Dapper
- Technical requirements
- Introduction to ORMs
- Configuring Dapper in minimal API projects
- Performing CRUD operations with Dapper
- Configuring Entity Framework in minimal API projects
- Performing CRUD operations with Entity Framework
- Summary
- Part 3 - Optimal Minimal APIs
- Chapter 10: Profiling and Identifying Bottlenecks
- Technical requirements
- An introduction to profiling and performance monitoring
- Introducing the profiler
- Performance metrics
- Profiling tools and techniques
- Profiling in Visual Studio
- Benchmarking with BenchmarkDotNet
- Common performance bottlenecks
- Summary
- Chapter 11: Utilizing Asynchronous Programming for Scalability
- Technical requirements
- Understanding and implementing asynchronous patterns in a minimal API
- Task-based asynchronous pattern
- TAP with async/await
- Asynchronous processing pattern
- Common pitfalls and challenges
- Summary
- Chapter 12: Caching Strategies for Enhanced Performance
- Technical requirements
- Introduction to caching in minimal APIs
- In-memory caching techniques
- Distributed caching strategies
- Response caching
- Summary
- Part 4 - Best Practices, Design, and Deployment
- Chapter 13: Best Practices for Minimal API Resiliency
- Technical requirements
- Code organization and structure
- Exploring folder structures
- Feature-based modular structure
- Layered modular structure
- Design patterns
- The factory pattern
- The repository pattern
- The strategy pattern
- Error Handling
- Security considerations
- Authentication
- Authorization
- Rate limiting
- Summary
- Chapter 14: Unit Testing, Compatibility, and Deployment of Minimal APIs
- Technical requirements
- Unit testing and integration testing for minimal APIs
- Compatibility and migrating minimal APIs to .NET 9
- Deploying minimal APIs
- Deploying to Microsoft Azure App Service (cloud deployment)
- Deploying to a Docker container
- Deploying on-premises with Kestrel
- Summary
- Index
- About Packt
- Other Books You May Enjoy
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.
File format: ePUB
Copy protection: without DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Use a reader that can handle the file format ePUB, such as Adobe Digital Editions or FBReader – both free (see eBook Help).
- Tablet/Smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePUB works well for novels and non-fiction books – i.e., 'flowing' text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook does not use copy protection or Digital Rights Management
For more information, see our eBook Help page.