Mastering ABP Framework

Book description

Learn how to build modern web applications from the creator of ABP Framework

Key Features

  • Build robust, maintainable, modular, and scalable software solutions using ABP Framework
  • Learn how to implement SOLID principles and domain-driven design in your web applications
  • Discover how ABP Framework speeds up your development cycle by automating repetitive tasks

Book Description

ABP Framework is a complete infrastructure for creating modern web applications by following software development best practices and conventions. With ABP's high-level framework and ecosystem, you can implement the Don’t Repeat Yourself (DRY) principle and focus on your business code.

Written by the creator of ABP Framework, this book will help you to gain a complete understanding of the framework and modern web application development techniques. With step-by-step explanations of essential concepts and practical examples, you'll understand the requirements of a modern web solution and how ABP Framework makes it enjoyable to develop your own solutions. You'll discover the common requirements of enterprise web application development and explore the infrastructure provided by ABP. Throughout the book, you’ll get to grips with software development best practices for building maintainable and modular web solutions.

By the end of this book, you'll be able to create a complete web solution that is easy to develop, maintain, and test.

What you will learn

  • Set up the development environment and get started with ABP Framework
  • Work with Entity Framework Core and MongoDB to develop your data access layer
  • Understand cross-cutting concerns and how ABP automates repetitive tasks
  • Get to grips with implementing domain-driven design with ABP Framework
  • Build UI pages and components with ASP.NET Core MVC (Razor Pages) and Blazor
  • Work with multi-tenancy to create modular web applications
  • Understand modularity and create reusable application modules
  • Write unit, integration, and UI tests using ABP Framework

Who this book is for

This book is for web developers who want to learn software architectures and best practices for building maintainable web-based solutions using Microsoft technologies and ABP Framework. Basic knowledge of C# and ASP.NET Core is necessary to get started with this book.

Table of contents

  1. Mastering ABP Framework
  2. Foreword
  3. Contributors
  4. About the author
  5. About the reviewer
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
  7. Part 1: Introduction
  8. Chapter 1: Modern Software Development and ABP Framework
    1. Challenges of developing an enterprise web solution
      1. Setting up the architecture
      2. Don't repeat yourself!
      3. Building a UI base
      4. Implementing common business requirements
    2. Understanding what ABP Framework offers
      1. The ABP architecture
      2. The startup templates
      3. The ABP infrastructure
      4. The community
    3. Summary
  9. Chapter 2: Getting Started with ABP Framework
    1. Technical requirements
      1. IDE/Editor
      2. .NET 6 SDK
      3. Database management system
    2. Installing the ABP CLI
    3. Creating a new solution
      1. Downloading the startup solution
      2. Using the ABP CLI
    4. Running the solution
      1. The connection string
      2. Creating a database
      3. Running the web application
    5. Exploring the pre-built modules
      1. Account module
      2. Identity module
      3. Tenant Management module
    6. Summary
  10. Chapter 3: Step-By-Step Application Development
    1. Technical requirements
    2. Creating the solution
    3. Defining the domain objects
      1. Category
      2. ProductStockState
      3. Product
      4. Constants
    4. EF Core and database mappings
      1. Adding entities to the DbContext class
      2. Mapping entities to the database tables
      3. The Add-Migration command
      4. Seeding data
      5. Migrating the database
    5. Listing the product data
      1. The ProductDto class
      2. IProductAppService
      3. ProductAppService
      4. Object to object mapping
      5. Testing the ProductAppService class
      6. Auto API Controllers and the Swagger UI
      7. Dynamic JavaScript proxies
      8. Creating a products page
      9. Adding a new menu item
      10. Creating the products data table
    6. Creating products
      1. Application service contracts
      2. Application service implementation
      3. UI
    7. Editing products
      1. Application service contracts
      2. Application service implementation
      3. UI
    8. Deleting products
    9. Summary
  11. Chapter 4: Understanding the Reference Solution
    1. Technical requirements
    2. Introducing the application
    3. Understanding the architecture
      1. Authentication flow
      2. Exploring the solution
      3. Project dependencies
    4. Running the solution
      1. Cloning the GitHub repository
      2. Running the infrastructure
      3. Opening the solution
      4. Creating a database
      5. Running the applications
      6. Using the Tye project
    5. Summary
  12. Part 2: Fundamentals of ABP Framework
  13. Chapter 5: Exploring the ASP.NET Core and ABP Infrastructure
    1. Technical requirements
    2. Understanding modularity
      1. The Startup class
      2. Defining a module class
      3. Module dependencies and the startup module
      4. Module lifecycle methods
    3. Using the dependency injection system
      1. Service lifetime
      2. Conventional service registrations
      3. Dependency interfaces
      4. The Dependency attribute
      5. Exposing services
    4. Configuring an application
      1. Setting the configuration values
      2. Reading the configuration values
    5. Implementing the options pattern
      1. Defining an options class
      2. Configuring the options
      3. Using the configured option values
      4. Setting the options via the configuration
      5. ASP.NET Core and ABP options
    6. Logging
    7. Summary
  14. Chapter 6: Working with the Data Access Infrastructure
    1. Technical requirements
    2. Defining entities
      1. AggregateRoot classes
      2. Entity classes
      3. Entities with CPKs
      4. The GUID PK
    3. Working with repositories
      1. Generic repositories
      2. Custom repositories
    4. EF Core integration
      1. Configuring the DBMS
      2. Defining DbContext
      3. Registering DbContext with DI
      4. Configuring entity mappings
      5. Implementing custom repositories
      6. Loading related data
    5. MongoDB integration
      1. Defining DbContexts
      2. Configuring object mappings
      3. Registering DbContext with DI
      4. Implementing custom repositories
    6. Understanding the UoW system
      1. Configuring UoW options
      2. Manually controlling the UoW
    7. Summary
  15. Chapter 7: Exploring Cross-Cutting Concerns
    1. Technical requirements
    2. Working with authorization and permission systems
      1. Simple authorization
      2. Using the permission system
      3. Policy-based authorization
      4. Authorizations outside of controllers
    3. Validating user inputs
      1. Using data annotation attributes
      2. Custom validation with the IValidatableObject interface
      3. Understanding the validation exception
      4. Disabling the validation
      5. Validation in other types
      6. Integrating the FluentValidation library
    4. Exception handling
      1. User-friendly exceptions
      2. Business exceptions
      3. Controlling exception logging
      4. Controlling the HTTP status code
    5. Summary
  16. Chapter 8: Using the Features and Services of ABP
    1. Technical requirements
    2. Obtaining the current user
      1. Defining custom claims
    3. Using the data filtering system
      1. The soft-delete data filter
      2. The multi-tenancy data filter
      3. Disabling a data filter
      4. Defining custom data filters
    4. Controlling the audit logging system
      1. Audit log object
      2. Audit log scope
      3. Auditing options
      4. Disabling and enabling audit logging in detail
    5. Caching data
      1. Using the IDistributedCache<T> interface
      2. Configuring cache options
      3. Error handling
      4. Using the cache in a multi-tenancy application
      5. Using Redis as the distributed cache provider
      6. Invalidating cache values
    6. Localizing the user interface
      1. Configuring supported languages
      2. Determining the current language
      3. Defining a localization resource
      4. Working with the localization JSON files
      5. Getting localized texts
      6. Configuring localization resources
      7. Localizing in special services
      8. Using localization on the client side
    7. Summary
  17. Part 3: Implementing Domain–Driven Design
  18. Chapter 9: Understanding Domain-Driven Design
    1. Technical requirements
    2. Introducing DDD
      1. What is domain-driven design?
      2. DDD layers
      3. Building blocks
    3. Structuring a .NET solution based on DDD
      1. Creating a simple DDD-based .NET solution
      2. Evolution of the ABP startup solution
      3. Separating the hosting from the UI
    4. Dealing with multiple applications
    5. Understanding the execution flow
    6. Understanding the common principles
      1. Database provider independence
      2. Presentation technology-agnostic
    7. Summary
  19. Chapter 10: DDD – The Domain Layer
    1. Technical requirements
    2. Exploring the example domain
    3. Designing aggregates and entities
      1. What is an aggregate root?
      2. Referencing other aggregates by their ID
      3. Keep aggregates small
      4. Determining the primary keys for entities
      5. Implementing entity constructors
      6. Using services to create aggregates
      7. Implementing business logic and constraints
      8. Using external services in entity methods
    4. Implementing domain services
    5. Implementing repositories
    6. Building specifications
      1. Parameterless specifications
      2. Parameterized specifications
      3. Combining specifications
    7. Publishing domain events
      1. Using the local event bus
      2. Using the distributed event bus
    8. Summary
  20. Chapter 11: DDD – The Application Layer
    1. Technical requirements
    2. Implementing application services
    3. Designing DTOs
      1. Designing DTO classes
      2. Validating input DTOs
      3. Object-to-object mapping
      4. DTO design best practices
    4. Understanding the responsibilities of the layers
      1. Authorizing users
      2. Controlling the transaction
      3. Validating the user input
      4. Working with the current user
    5. Summary
  21. Part 4: User Interface and API Development
  22. Chapter 12: Working with MVC/Razor Pages
    1. Technical requirements
    2. Understanding the theming system
      1. The base libraries
      2. The layouts
    3. Using the bundling and minification system
      1. Installing NPM packages
      2. Using the standard packages
      3. Importing script and style files
      4. Creating page bundles
      5. Configuring global bundles
      6. Creating named bundles
      7. Controlling the bundling and minification behavior
    4. Working with menus
    5. Working with Bootstrap tag helpers
    6. Creating forms and implementing validation
      1. Rendering form elements
      2. Validating user inputs
      3. Localizing forms
      4. Implementing AJAX forms
    7. Working with modals
      1. Understanding the basics of modals
      2. Working with forms inside modals
      3. Adding JavaScript for modals
    8. Using the JavaScript API
      1. Accessing the current user
      2. Checking user permissions
      3. Checking the tenant features
      4. Localizing strings
      5. Showing message boxes
      6. Showing notifications
    9. Consuming HTTP APIs
      1. Using the abp.ajax API
      2. Using dynamic client proxies
      3. Using static client proxies
    10. Summary
  23. Chapter 13: Working with the Blazor WebAssembly UI
    1. Technical requirements
    2. What is Blazor?
    3. Getting started with the ABP Blazor UI
    4. Authenticating the user
    5. Understanding the theming system
    6. Working with menus
    7. Using the basic services
      1. Authorizing the users
      2. Localizing the user interface
      3. Accessing the current user
    8. Using the UI services
      1. Showing message boxes
      2. Showing notifications
      3. Showing alerts
    9. Consuming HTTP APIs
    10. Working with global scripts and styles
    11. Summary
  24. Chapter 14: Building HTTP APIs and Real-Time Services
    1. Technical requirements
    2. Building HTTP APIs
      1. Creating an HTTP API project
      2. Creating ASP.NET Core controllers
      3. Understanding the Auto API Controllers
    3. Consuming HTTP APIs
      1. Using ABP's dynamic client-side proxies
      2. Using ABP's static (generated) client proxies
    4. Using SignalR with ABP Framework
      1. Using the ABP SignalR integration package
      2. Configuring SignalR clients
    5. Summary
  25. Part 5: Miscellaneous
  26. Chapter 15: Working with Modularity
    1. Technical requirements
    2. Understanding modularity
      1. Class libraries and NuGet packages
      2. Application modules
    3. Building the Payment module
      1. Creating a new application module
      2. Restructuring the Payment module solution
      3. Understanding the payment process
      4. Providing configuration options
    4. Installing the Payment module into EventHub
      1. Setting the project dependencies
      2. Configuring the database integration
    5. Summary
  27. Chapter 16: Implementing Multi-Tenancy
    1. Technical requirements
    2. Understanding multi-tenancy
      1. What is SaaS?
      2. What is multi-tenancy?
      3. The database architecture
    3. Working with the ABP multi-tenancy infrastructure
      1. Enabling and disabling multi-tenancy
      2. Determining the current tenant
      3. Working with the current tenant
      4. Switching between tenants
      5. Disabling the data isolation
      6. Designing the domain as multi-tenant
    4. Using the feature system
      1. Defining the features
      2. Checking for the features
      3. Managing tenant features
    5. When to use multi-tenancy
    6. Summary
  28. Chapter 17: Building Automated Tests
    1. Technical requirements
    2. Understanding the ABP test infrastructure
      1. Exploring the test projects
      2. Exploring the test libraries
      3. Running the tests
    3. Building unit tests
      1. Testing static classes
      2. Testing classes with no dependencies
      3. Testing classes with dependencies
    4. Building integration tests
      1. Understanding ABP integration
      2. Mocking the database
      3. Seeding the test data
      4. Testing repositories
      5. Testing domain services
      6. Testing application services
    5. Summary
    6. Why subscribe?
  29. Other Books You May Enjoy
    1. Packt is searching for authors like you

Product information

  • Title: Mastering ABP Framework
  • Author(s): Halil İbrahim Kalkan
  • Release date: February 2022
  • Publisher(s): Packt Publishing
  • ISBN: 9781801079242