Domain Model Pattern C
However if you need to tackle the complexity of a microservice s domain that has a lot.
Domain model pattern c. For the domain model for each bounded context you identify and define the entities value objects and aggregates that model your domain. Model driven design concepts the primary design patterns used in domain driven design are detailed below in this post but lets start with an overview of the concepts before we dive into the creation of aggregate roots and domain entities within a bounded context. Data mapper is more appropriate for systems with complex domain logic where the shape of the domain model will diverge considerably from the database model.
Data mapper also decouples your domain model classes from the persistence store. It means each domain class should have a direct relation to what it represents in the business domain. The msdn article titled persistence patterns speaks of the data mapper pattern.
Your domain model will be composed simply of your code. If this information is familiar to you then you can go directly to the domain entities and value objects in action section. You build and refine a domain model that is contained within a boundary that defines your context.
Domain driven design ddd is the concept that the structure and language of software code class names class methods class variables should match the business domain for example if a software processes loan applications it might have classes such as loanapplication and customer and methods such as acceptoffer and withdraw. Domain model structure in a custom net standard library. It will have just the ef core model requirements but not real dependencies on ef.
Now it is time to explore possible ways to implement the domain model by using net plain c code and ef core. Validate entities by implementing the specification pattern and the notification pattern. Domain driven design is all about how you model your domain.
You should not have hard dependencies or references to ef core or any other orm in your domain model. Specification pattern is a pattern that allows us to encapsulate some piece of domain knowledge into a single unit specification and reuse it in different parts of the code base. If the microservice you are creating is simple enough for example a crud service following the anemic domain model it is not an anti pattern.