Domain Driven Design
What is Anemic Domain Model and why it can be harmful?
Anemic Domain Model is a common approach in software development that many folks don’t even know they are using it including myself. If you are using Entity Framework, there is a chance you know this approach. But do you?
What is the Anemic Domain Model?
It is a Model which separates data and operation working with them from each other. In most of the time, your domain consists of two separated classes. One is the entity, which is holding data, the other is the stateless service, which operates with an entity.
Entity is usually represented with public properties. Setters and getters. Typical example of Entity Framework entity in the .NET application can look like this:
Stateless service, as the name suggests, is represented with stateless class, which means that it contains methods only…