Questions tagged [rich-domain-model]
17 questions
124
votes
10 answers
Rich vs Anemic Domain Model
I am deciding if I should use a Rich Domain Model over an Anemic Domain Model, and looking for good examples of the two.
I have been building web applications using an Anemic Domain Model, backed by a Service --> Repository --> Storage layer system,…

Sam
- 15,336
- 25
- 85
- 148
15
votes
2 answers
Domain driven design: How to deal with complex models with a lot of data fields?
Well I am trying to apply domain driven design principles for my application, with a rich domain model that contains both data fields and business logic. I've read many DDD books, but it seems that their domain models(called entities) are very…

Lord Yggdrasill
- 3,197
- 4
- 26
- 42
7
votes
1 answer
How to handle Persistence with Rich Domain Model
I am redesigning my NodeJS application because I want to use the Rich Domain Model concept. Currently I am using Anemic Domain Model and this is not scaling well, I just see 'ifs' everywhere.
I have read a bunch of blog posts and DDD related blogs,…

Frankra
- 133
- 8
4
votes
2 answers
Understanding rich domain models and dependencies
I'm trying to get my head around rich domain models and how to build semantic functionality into domain entities, where the domain entities are not tightly coupled to objects that provide implementations for semantic behaviour
For example, I want to…

Matthew Layton
- 39,871
- 52
- 185
- 313
2
votes
2 answers
Unit Testing Rich Domain Model
This was the anemic domain model:
public partial class Person
{
public virtual int PersonId { get; internal protected set; }
public virtual string Title { get; internal protected set; }
public virtual string FirstName { get; internal…

Hao
- 8,047
- 18
- 63
- 92
1
vote
1 answer
How to properly build rich domain models
Imagine rich domain model, called User with methods (omitting parameters):
TransferMoney()
SendFriendInvitation
AcceptFriendInvitation
The TransferMoney will be used to transfer money from user A to user B and. It involves adding money to account…

Szyszka947
- 473
- 2
- 5
- 21
1
vote
2 answers
Unable to resolve service for type 'System.Int32'
Is it possible to have interfaces with other paramaters together like here below?
I do this because I have private setters and have one constructor.
planning constructor (Logic)
public Planning(
IPlanningDAL planningDAL,
…

abus
- 51
- 5
1
vote
1 answer
Using app-level settings in rich domain models
I want to have a global/app level setting that I want to use in my rich domain models.
I have a method that does some calculations based on the argument passed.
This might not be the best example and might not look like a method belonging to the…

Konrad
- 6,385
- 12
- 53
- 96
1
vote
0 answers
Entity Framework - Persistence Model different from Domain Model
I have following lagacy code. There is a seperation between Pesistence Model and the (anemic) Domain Model. What is the benefit of this seperation and the implicit conversion ? Do you see any drawbacks ?
I know that with implicit conversion…

Lahmacun
- 97
- 1
- 8
0
votes
2 answers
Persistence and Domain layers separation within a Rich Domain Model application
There is a concept that talks about the separation of the persistent layer from the domain layer to make the domain layer more robust - it would not be dependent on the actual implementation of the repository in persistence layer, but only on the…

YevgenyL
- 281
- 3
- 20
0
votes
1 answer
Is there a elegant way of putting domain validations inside domain layer?
I am new to domain driven design and there is one thing that is bothering me when I'm writing domain model. How to handle domain validation?
I am designing library management system where user can search through books and see if book is on the…

S.Pavlovic
- 3
- 3
0
votes
1 answer
Error in form POST: Model bound complex types must not be abstract or value types and must have a parameterless constructor
I'm getting an error while running my project and sending a POST through my Register.cshtml View. See the error below:
InvalidOperationException: Could not create an instance of type 'AdoteRJ.Models.Adotante'. Model bound complex types must not be…

Pedro Coelho
- 1,411
- 3
- 18
- 31
0
votes
1 answer
What if value needs to be corrected?
I know that DDD suggests to create separate usecases foreach business operation.
Imagine you have a Player aggregate. It has Address Value Object.
DDD doesn't allow to create an UpdatePlayer() method on PlayerApplication layer. What we should do…

DmitriBodiu
- 1,120
- 1
- 11
- 22
0
votes
1 answer
Rich Domain Model and form mapping
TLDR: How combine rich domain model with "heavy" setters with simple HTML form mapping?
Problem occurs when setter of one property change other properties (directly or by using setters - this doesn't matter).
Sample class for better explaining (in…

Stawi
- 1
0
votes
1 answer
Unity Of Work + Rich domain
I'm trying to implement a rich model with Unit of Work.
public class User : BusinessBase, IUser
{
public int UserID { get; }
public string Name { get; set; }
public string LastName { get; set; }
public string…
user5550554