开发者

ASP.NET MVC with DDD architecture

I am trying to understand Asp.Net MVC with DDD following is the structure of application according to the http://aspnetdesignpatterns.codeplex.com/

Application Layers

Presentation Layer => MVC views,

Controllers(MVC) => MVC Controllers class,

Cached Service => ?,

Application Service => ?,

Domain Model => ?,

Repository => repository class to interact with DB,

Infrastructure => Class for logging, mailing etc.

here m having confusion in Application service and domain model, where should i fit my business logic (in service or in domain model)

what exactly should be in service and what should be in domain.

e.g suppose i want to add customer in DB how should be the flow..?

as i know,

in controller class i will write like

var customeService = new CustomeService (_customerRepository);
cu开发者_JS百科stomeService.Add(customer);

if m wrong please correct me here..

_customerRepository goes in repository

what goes in model and what should be the flow of code.

please clear me. thanks in advance.


Eric Evan's book is the best place to start DDD as mentioned by @Arnis. Domain Driven Design Quickly is a short, quick-readable summary and introduction to the fundamentals of DDD.

what goes in model and what should be the flow of code.

Please check the following answer from @calebboyd to get an idea of DDD flows.

And about MVC, you can separate the controller from your presentation layers(views). But are you using this controller actions in different projects? If answer is no, my opinion is to keep it in one project.


Have You read this book? Start with that.

Term Service is overloaded.

Domain services encapsulates small part of domain logic that does not fit naturally in any of domain object (some say it's a sign that there's unidentified aggregate root in Your domain).

Application services contains zero domain logic. They coordinate domain.

Infrastructure services seems to me quite self-explanatory. Those contain technical details.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜