Introduction

Flexbase Solution structure

Let us start by understanding the solution structure.

The solution is organized into several folders and projects that makes the development more organized and suitable for the developer.

Presentation Layer:

The first thing that we will see is the presentation layer. It contains the input and output api models and the messages. The presentation layer is responsible for structuring the data, which is needed as an input or to be given as an output.

Business Layer:

The next layer is the business layer. In that, the first thing we will look at is the domain model.

Domain Model

The domain model layer contains the domain models which is linked to the structure of how your database is created.

Mappers

the mappers that are responsible for mapping the input-output model with the domain model.

Queries

Queries contains the queries to the database with an option to use the Read Db exclusively for queries.

Pre-Bus

Here, the pre-bus is responsible for processing the input, output, and validations.

Post-Bus

It is responsible for handling the request after the messages are passed through a bus in the handlers.

It contains the subscribers as well. Subscribers respond to the events generated by the handlers.

Infrastructure Layer:

The next layer is the infrastructure. We have the bus infrastructure and the persistence layer.

Bus Infrastructure

The bus infrastructure is responsible for configuring the bus that passes the messages across handlers as well as subscribers,

Persistence

Persistence layer is responsible for any Db persistence related configuration.

Also, as we move along with the projects, you will get to know that the code that we generate or write, is independent of the bus and of any of the available persistence technology.

Hosting Layer:

Then we have the endpoints. These are responsible for executing the applications.

We have given three default Endpoints.

Web API

WebAPI Endpoint is an asp.net core web application derived template that is responsible for interfacing with any of the front end.

Handlers

Handlers are responsible for the first level processing of the commands. Most of the persistence logic is handled by the handlers.

Subscribers

Subscribers are responsible for handling the events raised by the command handlers and other subscribers.

Bridge Layer:

And lastly, we have something very interesting that will excite developers. It is the bridge layer.

So the bridge layer as rightly called, acts as a bridge between the application code and Flexbase.

Whatever code we generate is done as a bridge code, so that it is easier for you to customize the Flexbase interfaces and other classes as per your need in the bridge layer. Also, you don't have to regenerate the code in the client to implement any customizations.

Video:

Sample Code:

Next, let’s look at each of the projects and layers in depth.