A microservice architecture – a variant of the service-oriented architecture (SOA) structural style – arranges an application as a collection of loosely-coupled services.
Wiki
The microservices keyword is very hot keyword in recent years, that is kind of a variant of the service-oriented architecture(SOA) structural style. It can find out the microservices keyword has a “micro-” word so that means this service is not very huge services or monolithic services. Sometime, the situation most doesn’t follow the atomic service principle. A little situation will follow the atomic service principle. It must accord the situation to chose option.
What kind of microservice architecture will be good for the junior programmer/the enterprise using the microservices for first time?
In my personal viewpoint, I will provide the onion architecture option for them because the onion architecture is the 2008 year’s idea, and is very simple and clear understand the architecture in the common web application. The modern web application keep uses this concept to explained other web framework that is a good start point.
What a kind of characteristic is the microservice property in going into production with a microservices-based system?
- Monitoring and health checks of the services and infrastructure.
- Scalable infrastructure for the services (that is, cloud and orchestrators).
- Security design and implementation at multiple levels: authentication, authorization, secrets management, secure communication, etc.
- Rapid application delivery, usually with different teams focusing on different microservices.
- DevOps and CI/CD practices and infrastructure.
From .Net microservices – architecture
How to solve the data sovereignty per microservice?
In many enterprise cases, the enterprise’s solution architecture will advise the clients or the general manager that the microservices must include all of the business logic concepts, then making the Docker image in the Docker containers, which idea is the data in the traditional approach. In the real microservice implemented, everyone microservice owns its domain data and the logic under an autonomous lifecycle, with independent deployment per microservice.
We can design more microservices with the same databases, but everyone microservices must own its domain data and the logic. It can’t cross the domain data and the logic to do some things.
How to implement the elemental microservice web API without the API Gateway in .NET?
Step 1 Create the .NET 5 projects and chose the API template projects.



Step 2 Create the Core layer projects and the Infra layer projects.


Step 3 Setting the database connection string in appsetting.json file. A part of developers will set the developed model database connection string in the appsetting.Developement.json file, but this sample doesn’t use this method.
Step 4 Creating the generic type repository with the dispose mechanism.
Read more information. Generic Type in Repository – .NET Core Part
Step 5 Adding the AOP mechanism and install the serilog Nuget package.
Read more information. Aspect-oriented programming in .NET Core
Step 6 Create the authentication service project which chose solution is the Microsoft recommended third-party option – IdentityServer4. In the common situation, the authentication service won’t design the local services in the same network, and will be designed the closed service in other network.

Step 7 Create the authorization mechanism in the microservices.

Step 8 Create the new controller file for demoing your project which is work with IdentityServer 4 mechanism.




Step 9 Try demo API on the swagger page.

Reference
- Creating a simple data-driven CRUD microservice
- Generic Type in Repository – .NET Core Part
- Aspect-oriented programming in .NET Core
- IdentityServer4 document
1 Comment