MODELING AND IMPLEMENTATION OF DOMAIN EVENTS IN THE DOMAIN-DRIVEN ARCHITECTURE ON THE .NET CORE PLATFORM
DOI:
https://doi.org/10.31891/csit-2023-2-10Keywords:
domain-driven design, DDD, design of complex domain areas, events of the domain areaAbstract
A software architecture centered on a domain model can provide significant advantages over other types of architectures in the long-term development and maintenance of systems with complex domain logic. At the same time, domain-driven design and approaches to software implementation of systems are relatively new concepts and continue to develop in application to various platforms, technologies and programming languages, and are of considerable interest to designers and developers. The presented work examines existing approaches to modeling and implementing domain events on the .NET Core platform in domain-driven architecture, which is one of the newest patterns. There are two approaches to implementing domain event behavior: immediate and delayed event propagation. These two approaches are analyzed and their features are described in detail. The implementation of instant propagation of domain events within a command execution transaction in the CQRS architecture is described. This implementation allows you to get rid of external dependencies, achieve purity of domain entities, as it eliminates the need to inject services, repositories in entities, and also prevents memory leaks and is safe for multithreaded use. Schematically depicts the abstract process of an external command entering a domain model, which causes a change in the state of an aggregate and the propagation of side effects with domain events. This process takes into account the capabilities of the Entity Framework object-relational mapping framework to retrieve context objects that have been changed during process. The entire stack of objects involved in this activity is located in the shared process memory, and the interaction occurs in synchronous mode. For the conceptual detection of events and aggregates, the event storming technique is used, the features of which are discussed in the article.