Monday, December 14, 2020

Add Superpowers to Your Next ASP.NET Project with the ABP Framework

Two years ago I discovered ASP.Net Boilerplate and on two subsequent projects realized enormous time savings and quality improvements thanks to it.  The ABP Framework (aka ABP.IOis the next version of ASP.Net Boilerplate, and it promises the same benefits, but on a cleaner, more modern stack.

I've held off writing about the ABP Framework because when 1.0 was released, in 2019 with .NET Core 3, I felt it wasn't sufficiently mature to start a new project on ... yet.  But with the launch of ABP Framework version 4.0 last week, which supports .NET Core 5, it's time to re-evaluate.

In this post I'll review what it is, and go over the benefits and features with an eye toward what's changed since ASP.Net Boilerplate.

What is the ABP Framework?

In case you're new to it I describe both it and it's predecessor as follows:

It is:

  1. A one-time code generator for new ASP.Net Core projects, and
  2. A framework,

that provides an end-to-end working site on day 1, along with foundational features and best practices.

I like this definition because I think it's critical to understand both the code generation and framework aspects.  Code generation grants the flexibility to easily customize the generated site to fit your needs.  The framework allows the ABP.IO team to easily ship updates, enhancements and bug fixes through NuGet or NPM updates.

Previously, ASP.Net Boilerplate put the emphasis on the code-generator side. The ABP Framework instead weighs more toward the framework side, with the benefit that they can help keep your bits fresh.


ABP.IO is composed of two elements:

  1. The ABP Framework, the free and open source foundation
  2. ABP Commercial, the optional add-on component that provides additional features and grants support and helps keeps Volosoft in business

Benefits

ABP.IO provides the same benefits as ASP.Net Boilerplate: it gets you up to speed extremely fast with a well thought out domain driven architecture, a ton of pre-implemented best practices, a ton of foundational features, and excellent documentation.  Basically it allows you to kick butt on day 1, and well into the future.


Front End Features

Front-End Choices


With ABP.IO you can choose from among three front-ends.  Sadly it loses the Vue and React options from ASP.Net Boilerplate, but it still has an MVC and Angular front end, and the best news is it giveth where it taketh away with: Blazor!  I generated a quick Blazor app and gave it a quick once-over and so far it looks great, just like the Angular one (see also Blazor vs Angular).

Themes

One thing that's entirely new with the front-end is themes:


Themes are nice if you're on ABP Commercial, because the "Lepton" themes are attractive and you have several to choose from.  If you're on the free ABP Framework there's a base one for all front-ends or several community developed ones to choose from (currently only for MVC and Razor front-ends).

If you need to heavily customize the look and feel of your site you will likely find themes are more work than with ASP.Net Boilerplate, especially in Angular.  But, themes do allow the framework to send down bug fixes and enhancements, so this is a trade off.

UI Helpers

UI helpers are a new super helpful front-end feature.  They offer reusable components that are far less code duplication than the previous version.


The table helpers in particular (for Angular) make building data tables with pagination, sorting, and filtering super easy.


Auto-Generated Service Proxies

Just like in ASP.Net Boilerplate ABP.IO gives you Swagger files out of the box with Swashbuckle.  However, in the Angular world ABP.IO drops NSwag in favor of a custom Typescript proxy generation with it's own CLI.  One benefit is many smaller files rather than one gigantic proxy file.


Back-End Features

If you've ever started a new project you know there's a lot of things to set up, and a lot of ways to do it wrong.  This is where ABP.IO shines.  It takes care of everything, and correctly too.


There's simply too many back-end features to cover.  But here's an attempted quick overview anyway:

  • Dependency Injection - ABP.IO removed Castle Windsor, and replaced it with Microsoft's dependency injection extension library implemented via Autofac, huge win! 🎉
  • Logging - ABP sets up ASP.NET Core's logging system for you, and now it additionally logs all EF SQL queries for easier performance debugging 😎
  • Localization - Awesome feature front-to-back, but now in json and with Microsoft.Extensions.Localization instead of xml
  • Authorization - Declarative based authorization with permissions has always been a super power of ASP.Net Boilerplate, and it's just as awesome in V2, but now it has better support for oAuth 2 and Identity Server
  • Multi Tenancy - If you need this feature you need to use ABP.IO, it will save weeks of dev effort (see also Multi-Tenancy is Hard: ASP.Net Boilerplate Makes it Easy).
  • DDD Based App Services - The DDD approach helps organize project code and keep it maintainable while framework implemented CRUD base classes help you avoid a ton of boilerplate
  • Repository Pattern - Great for modularity and simplified unit testing
  • Validation - Server-based validation is simple and DRY, just as awesome as it had been
  • Auditing - I have always loved this feature.  By simply implementing an interface (IFullAuditedAggregateRoot) you get modified date, modified by, created date, and created by: no extra coding
  • Soft delete - Just implement an interface and delete operations fill in an IsDeleted column, and data retrievals ignore records where it's true.  Fantastic.
  • Exception Management - This is hard to do right, but ABP.IO kills it.  Unexpected exceptions product detailed logs and a pleasant generic message to the end user.
  • And more - ABP.IO brings forward a ton of awesome features like SignalR setup, background jobs, an event bus, and modules adds a ton of new features like C# based data-seeding and the Virtual File System

Summary

That's a quick overview of ABP.IO.  Having dug into the details, I would choose it for my next project.  I recommend it.

If you're interested in a deep dive on the details including two technical demo's please check out my hour long Code Hour episode on ABP.IO.



If, after watching that you don't choose ABP.IO for your next project, I'll be surprised.  After all, why wouldn't you want to be a superhero on your next project?

1 comment:

Unknown said...

I do not agree with your very limited assessment of the abp.io framework. While the idea of Tenants, OU's etc. are very good the company behind this product does not treat its customers well; with my 1st hand experience in actually purchasing the Commercial Abp.io and then being switched to the AspnetZero product.

The difference is that the AspnetZero has a working solution to be modified by the user. The Commercial Abp.io only give you the beginnings of a system, then based on the price source code to create a customer version of a Purhasing system, etc.

Both involve alot of programming to get a working system, both have outdated Help Systems and both do not explain their current products based on the release.

Note: when a .net 5 release happens, it takes 1 or 2 releases to fix the problems.

No i am not in-like with either product but do not think there is a better alternative to either product for tenant & user management based on the price.

It just necessary to understand what a customer is buying, which is not explained well at all.