Edition 0 Updated to asp. Net core 0



Yüklə 11,82 Mb.
Pdf görüntüsü
səhifə229/288
tarix12.07.2023
ölçüsü11,82 Mb.
#136458
1   ...   225   226   227   228   229   230   231   232   ...   288
NET-Microservices-Architecture-for-Containerized-NET-Applications

Additional resources 

Modeling document data for NoSQL databases
https://learn.microsoft.com/azure/cosmos-db/modeling-data
 

Vaughn Vernon. The Ideal Domain-Driven Design Aggregate Store?
https://kalele.io/blog-posts/the-ideal-domain-driven-design-aggregate-store/
 

Introduction to Azure Cosmos DB: API for MongoDB
https://learn.microsoft.com/azure/cosmos-db/mongodb-introduction
 

Azure Cosmos DB: Build a MongoDB API web app with .NET and the Azure portal
https://learn.microsoft.com/azure/cosmos-db/create-mongodb-dotnet
 

Use the Azure Cosmos DB Emulator for local development and testing
https://learn.microsoft.com/azure/cosmos-db/local-emulator
 

Connect a MongoDB application to Azure Cosmos DB
https://learn.microsoft.com/azure/cosmos-db/connect-mongodb-account
 

The Cosmos DB Emulator Docker image (Windows Container)
https://hub.docker.com/r/microsoft/azure-cosmosdb-emulator/
 

The MongoDB Docker image (Linux and Windows Container)
https://hub.docker.com/_/mongo/
 

Use MongoChef (Studio 3T) with an Azure Cosmos DB: API for MongoDB account
https://learn.microsoft.com/azure/cosmos-db/mongodb-mongochef
 


267 
CHAPTER 6 | Tackle Business Complexity in a Microservice with DDD and CQRS Patterns 
Design the microservice application layer and Web 
API 
Use SOLID principles and Dependency Injection 
SOLID principles are critical techniques to be used in any modern and mission-critical application
such as developing a microservice with DDD patterns. SOLID is an acronym that groups five 
fundamental principles: 

Single Responsibility principle 

Open/closed principle 

Liskov substitution principle 

Interface Segregation principle 

Dependency Inversion principle 
SOLID is more about how you design your application or microservice internal layers and about 
decoupling dependencies between them. It is not related to the domain, but to the application’s 
technical design. The final principle, the Dependency Inversion principle, allows you to decouple the 
infrastructure layer from the rest of the layers, which allows a better decoupled implementation of the 
DDD layers. 
Dependency Injection (DI) is one way to implement the Dependency Inversion principle. It is a 
technique for achieving loose coupling between objects and their dependencies. Rather than directly 
instantiating collaborators, or using static references (that is, using new…), the objects that a class 
needs in order to perform its actions are pro
vided to (or “injected into”) the class. Most often, classes 
will declare their dependencies via their constructor, allowing them to follow the Explicit 
Dependencies principle. Dependency Injection is usually based on specific Inversion of Control (IoC) 
containers. ASP.NET Core provides a simple built-in IoC container, but you can also use your favorite 
IoC container, like Autofac or Ninject. 
By following the SOLID principles, your classes will tend naturally to be small, well-factored, and easily 
tested. But how can you know if too many dependencies are being injected into your classes? If you 
use DI through the constructor, it will be easy to detect that by just looking at the number of 
parameters for your constructor. If there are too many dependencies, this is generally a sign (a 
code 
smell
) that your class is trying to do too much, and is probably violating the Single Responsibility 
principle. 
It would take another guide to cover SOLID in detail. Therefore, this guide requires you to have only a 
minimum knowledge of these topics. 

Yüklə 11,82 Mb.

Dostları ilə paylaş:
1   ...   225   226   227   228   229   230   231   232   ...   288




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin