Flexbase Solution Structure

The first one in the Business layer is the Domain. Under that we have three projects viz. DomainModels, mappers, and queries.

Domain Models

When object-oriented programming was first introduced, it held the promise that objects in software could model objects in the world. As it was adopted into enterprise software development, objects started to model the world less and the computer more. Eric Evans refocused object-oriented analysis and design onto the problem domain with his 2004 book Domain-Driven Design.

This is the core of your domain structure. Define your Domain models here and this will be used to create the Db and Tables in your chosen database platform. By default, we use Entity Framework for generating the database and tables. The domain model is also equivalent to your data structure that is going to be stored in a database.


The mappers are used to map the InputAPIModel or OutputAPIModel with the domain model. We are not going to expose the domain model directly to the outside world or the other application. It is exposed only through an API and all the interaction happens through the input and output API model and maintain the segregation.

This gives a lot of flexibility in terms of your data structuring and keeping it independent from your database structure. This also reduces a lot of complexity


Lastly, we have the query layer. All the queries for the application is written in this project. The Queries also use a different configured repository which helps keeping the Read Db separate for more optimizations. During development or during low load in production, same db can be used by giving the same connection string for both Read and Write Repository.

Note: Default Read and Write Db segregation is for a scenario where Replication can be used to keep the read Db separate keeping the same structure of your domain.


Last updated