Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which design pattern Abp Framework (abp.io) are developers using?

At my company we are using the brand new Abp framework (abp.io). As it's a new framework, lots of documents are missing so we have to search at source code. Looking so much at the code I realized that's a pattern they're using that always appears Providers, ProvidersManagement, DefinitionProvider and so on. I would like to know if this pattern has a name or it's something just used there. I don't believe it's second option but I don't know.

Feature Module, Settings Module, Permission Modules are all module that are implemented using such design pattern.

Thank you guys!

like image 660
carlosza Avatar asked Jul 15 '20 22:07

carlosza


People also ask

What is ABP IO framework?

ABP Framework is a complete infrastructure to create modern web applications by following the best practices and conventions of software development. SOURCE CODE GET STARTED.

Why use ABP framework?

ABP Framework is designed to solve real-time problems and build complex systems. It provides a lot of infrastructure requirements already implemented for your system and provides lots of integrations to enterprise systems and tools.

What is ABP boilerplate?

ASP.NET Boilerplate (ABP) is an open source and well-documented application framework. It's not just a framework, it also provides a strong architectural model based on Domain Driven Design, with all the best practices in mind. ABP works with the latest ASP.NET Core & EF Core but also supports ASP.NET MVC 5.

Is ABP framework free?

ABP Framework is completely free, open source and community-driven and provides a free theme and some pre-built modules.


1 Answers

I wanted to answer the question as the programmer behind these patterns in the ABP framework;

First of all, I want to explain why we are introducing these "provider" style pattern. The main reason is extensibility: A developer can extend the system by just implementing a provider interface and registering it to the framework. In this way, you don't need to replace or override a complete service to add a new behaviour.

For example, PermissionChecker service loops through the providers (those implement the IPermissionValueProvider interface) to allow you to decide if the current user has the requested permission. There are some pre-defined permission providers: user provider, role provider... etc. User provider checks if the current user has directly authorized for the permission while role provider checks if any role of the current user has the required permission. You can simply create a new provider implementation that checks the permission in a different way and allows the users to perform the related operation.

There are similar patterns used in the ASP.NET Core too.

For example, ASP.NET Core request localization middleware uses a similar pattern to determine the current culture for a web request. There are QueryStringRequestCultureProvider, CookieRequestCultureProvider... classes tries to determine the culture from different sources. It is also extensible, you can register new providers or re-order current providers.

We generally name such classes as "provider" or "contributor" in the framework.

Contributors are different classes those are participants of an operation. For example, for the menu system, there is a IMenuContributor interface that you can implement and take part while building the main menu in the application (add/remove/replace menu items).

The pattern is also similar to "Chain of Responsibility" pattern. For example, IPermissionValueProvider is similar to CoR pattern since each provider tries to check if the current user has permission for an operation. If the provider doesn't know that, the next provider is executed.

So, I don't know the exact name and I didn't 100% copied a pattern while implementing these. If this is a new pattern (I don't think so, but) I am not good at naming pattern, let's ask to Martin Fowler :)

BTW, we are constantly improving the documentation of the ABP Framework. In the previous milestone, we've completed most of the fundamental documents (like UOW, distributed event bus... etc). Recently, completely revised and extended the startup tutorial. Documentation will be a high priority in the next milestones too.

Thank you for using the ABP Framework :)

like image 196
hikalkan Avatar answered Oct 06 '22 00:10

hikalkan