I'm developing an application which implements multi-tier pattern where MySQL is used for persistence. There is a WCF service which provides access to data and provides DTOs.
Further, I plan to implement the following patterns: - DTOs - MVP (not yet sure if passive view or supervising controller) - Code against interfaces where applicable
Currently, I rawly have the following project structure:
+-------------------------------+
| MySQL DB Server |
+------+------------------------+
^
| Uses Entity Framework 5.0
|
+
+-------------------------------------------------------------------------------+
| Application Server |
|-------------------------------------------------------------------------------|
|+------------------+ +----------------+ +--------------+ +--------------------+|
|| Data Access Layer| | Contracts | | Communication| | Business Layer ||
||------------------| |----------------| |--------------| |--------------------||
|| - EF 5.0 Entities| | - WCF Contracts| | - WCF Service| | - Actual Service ||
|| | | | | Hosts | | - Session management|
|| | | | | | | - Security and ||
|+------------------+ +----------------+ +--------------+ +--------------------+|
+-------------------------------------------------------------------------------+
^
| Communicates via DTOs which are acutally wrappers for Entities
| eg. GetUserByID() or SaveUser(userDTO)
|
|
+-------+-----------------------------------------------------------------------+
| Clients |
|-------------------------------------------------------------------------------|
|+-------------------+ +-------------------+|
|| Business Layer |+----------------------------------->| GUI (Winforms) ||
||-------------------| BLL receives DTOs and creates |-------------------||
|| -Provide WCF Servi| Domain Objects (eg. User) which are| -Implementation of||
|| ce Access | Processed by presenters and passed | View Interfaces ||
|| -Service Reference| to views where they are bound to | ||
|| -Implementation of| controls. | ||
|| Presenter Interf.| | ||
|+-------------------+ +-------------------+|
+-------------------------------------------------------------------------------+
+------------------------------------------------------------------------+
| General |
|------------------------------------------------------------------------|
|+---------------------+ +--------------------+ +-----------------------+|
|| DTOs | | Interfaces | | Library ||
||---------------------| |--------------------| |-----------------------||
|| -DTO Definitions | | -View Interfaces | | -General Helper Classe||
|| | | -Presenter Interf. | | s eg. Cryptography ||
|| | | -Domain Model IF. | | ||
|+---------------------+ +--------------------+ +-----------------------+|
+------------------------------------------------------------------------+
Outer boxes are project folders in Visual Studio. Inner boxes are C# Projects
Before I continue coding and spend more time in actual implementation, I just like to get some feedback about the structure / architecture of my project.
I'm wrapping my head around following questions:
Sorry for this long post, but I thougt it would be better to combine my questions into one post and provide the project structure within.
Thanks in advance for any kind of answer.
Regards
The structure that you propose is quite similar (mutatis mutandis) to one of our application that was deployed in production 2 years ago. It works, but you have to carefully design the domain model, separating in different bounded context the various aspect of the application.
So these are my own answers:
Before you start, I think you should ask yourself some questions:
Finally, if you really need DDD, and you are new to it, you could find the Epic's modeling patterns useful (disclaimer, I'm one of the Epic devs and I designed all of them during the last 5 years of DDD trial and errors).