Reputation: 23
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
Upvotes: 2
Views: 1445
Reputation: 7210
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).
Upvotes: 4
Reputation: 1884
I Will answer one by one
1) It Depends on the complexity of the application. If your are working on complex domain its good to follow domain driven design
2) If you say BLL, it should only take care of the business logic not any technical details like session, security ..
3) Its good to have domain objects in the server side. It promotes reusability
4) You should not expose domain objects outside. DTOs are better option. You can use Automapper for all the mapping related work
5) Its good to have validations in each component depending on the scope
6) DTOs would be better
Additionally you can Service stack than WCF as it is built on industry best practices.
Upvotes: 0