This is a personal blog project, although the blog does not need to do such a complex design. But the company has the demand, therefore first oneself to get a project to practise practicing. The project needs to meet the following requirements
1. Layer and layer need decoupling, in the later online update maintenance does not need to overwrite, only need to update the local DLL, that is, plug-in mechanism
2. Code security, the company has to find outsourcing companies to some people, but do not want them to get all the code, you need to use the interface to standardize development.
3. At first there was no complete requirement specification and database design documentation. We are light document development, that is, the need to change at any time before the full online, and the database was not designed at the beginning, but to develop a point to add, and will change the requirements at any time.
To ensure the above points, we need to build a very flexible system, for a just beginning to participate in the. NET development work is very challenging for me, although there have been a lot of expert advice.
2. Program Design
In the design, I considered the above requirements, I roughly divided the layers.
1. Entity model layer: Codefirst entity object
2. Data Access Layer: DbContext object, in fact, after I contacted the EF on the data Access layer concept is not the same, I now feel that the data access layer is not too much need. Because you don't need to write SQL statements, they are lambda expressions. This is my question, everybody can discuss it together
3. Database access interface layer: Canonical database access layer
4. Database Access Layer Factory: Here I can reflect the instance of the data access layer through reflection
5. Business Logic Layer: Business logic code
6. Business logic Interface: Standardize business logic
7. Business Logic Factory: Reflection Business Logic Example
8.MVC: Front Show
1. Through the above we can find that the layer is decoupled from the layer, for example, I followed a layer of interface specifications to write a DLL, and then update the server, do not have to compile the entire project, and do not need to overwrite the entire project, only need to modify the reflection of the configuration file can not affect the normal operation of the site, This is the effect I want.
2. The interface specification is good, also need not encode the person to get the whole project to hand, as long as oneself according to the interface specification writes the code, puts in the test environment a test on OK. This will ensure that the company's code security still has a certain effect.
3. By Codefirst we can easily replace the requirements, and do not have to start with all the requirements listed, and then design the database, we can do when the function side to add tables.
The above ideas should be more suitable for popular, small and medium-sized projects in accordance with such design should be no problem. If you have any good suggestions or find something wrong, please put forward, so as not to mislead others.