Below is the design pattern that I came up with and would like to use as I develop future .NET web applications:
4 LAYERS:
- Business - C# Class Library
- Data - C# Class Library
- Model - C# Class Library
- WebUI - MVC5 Application
Model
This layer will contain all of my business entities and all of their properties. i.e. Customer, Project.
- References: None
Data
This layer will contain all of my data access functions. I usually create a Repository for each main entity in the system. i.e. CustomerRepository, ProjectRepository.
- References: Model
Business
This layer will contain all of the business logic in the application. This project will contain interfaces for each class in it: i.e. ICustomerManager, IProjectManager and additionally interfaces for each repository in data: i.e. ICustomerRepository, IProjectRepository.
- References: Model, Data
WebUI
This layer consists of an asp.net MVC5 application. It will be using dependency injection in the controllers. It will call functions in Business as needed.
- References: Model, Business
My concerns:
I would like to know if I am putting my interfaces in the correct projects. As of now all of my interfaces are in Business. Does this make sense? Or should my repository interfaces be in Data?
Additionally should my business interfaces be in the MVC5 project rather than Business?
Any other comments/suggestions on this design besides just where I should place the interfaces would be helpful. Any good books or tutorials that may help with this topic would be helpful also.
Aucun commentaire:
Enregistrer un commentaire