WooHoo
WooHoo

Reputation: 1922

DDD and ASP.NET - where do you use repositories?

I'm new to DDD. I have an existing ASP.NET application (not MVC) and I would like to start implementing a domain driven design.
However, I'm not sure where I should call the repository from. For example if I had a customer repository with a Save method, my understanding is that I should not call the Save method from the customer entity. I thought about using a service but then my understanding is that a service should be used to co-ordinate actions e.g. money transfer seems to be a common example. So do I call the repository class in the page code-behind or do I create another layer or am I missing something?

Thanks in advance.

Upvotes: 0

Views: 201

Answers (1)

jgauffin
jgauffin

Reputation: 101192

Keep it simple, don't overdesign.

Start with calling it directly from the CodeBehind. If you find yourself calling different repositories in the future, create a service and move the logic to it.

Upvotes: 1

Related Questions