开发者

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

开发者 https://www.devze.com 2023-01-18 11:17 出处:网络
I\'m new to DDD.I have an exi开发者_开发问答sting ASP.NET application (not MVC) and I would like to start implementing a domain driven design.

I'm new to DDD. I have an exi开发者_开发问答sting 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消