Структура проектов DDD с WCF

SELECT COUNT(DISTINCT column_name) FROM table as column_name_count;

необходимо считать то отличное седло, затем дать ему псевдоним.

5
задан yo. 29 November 2009 в 21:02
поделиться

1 ответ

If you are doing DDD I find it strange that you have no domain model. You have a so-called engine, which has multiple concerns. It implements your business logic and knows about hosting your business logic as a windows service.

I would propose a project structure as follows:

MyProject.Model: Defines abstract repositories, entities, value objects, services (DDD term) and other domain logic. It has no references to other projects

MyProject.DataAccess: implementation of repositories using linq2sql. Has a reference to MyProject.Model

MyProject.ServiceModel: Contains service contracts and other stuff related exposing your domain model as WCF services. this project would also contain service specific representations of those of your domain objects that the service serves and accepts. The reason for this would be that you should probably not decorate your domain classes with the attributes needed in WCF data contracts. This project references MyProject.Model.

MyProject.Service: Contains app.config for your service and performs dependency injection, through a custom ServiceHost and ServiceHostFactory. It references MyProject.Model MyProject.ServiceModel and MyProject.DataAccess + your favorite DI framework (Windsor Castle for example)

MyProject.PresentationModel: Defines various view models and commands to use in your UI. It has service references to the services exposed by MyProject.Service

MyProject.WinUI: Your WPF app. References MyProject.PresentationModel.

Note that most of what you have probably read in Eric Evans' book about DDD is only concerned with the contents of MyProject.Model. The other projects are making up additional layers not directly addressed in mr. Evans' book.

Remember that by having a clear separation of concerns, and using dependency injection you will end up with code that is easily tested. With the structure I have proposed above, you should be able to test almost everything, since your UI will contain only XAML.

Anyway, this is just my take on it. Please feel free to ask if some of this needs clarification.

Good luck with the project.

/Klaus

21
ответ дан 18 December 2019 в 07:29
поделиться
Другие вопросы по тегам:

Похожие вопросы: