Original address: http://ddmvc4.codeplex.com/
Original article name:Design and develop a website using ASP. net mvc 4, EF, knockoutjs and bootstrap
Another MVC application Program : Introduction
The site is always growing rapidly. Once it starts to grow, it becomes difficult to develop, organize, and maintain the site. Therefore, when we add features or develop projects, large websites without design will become out of control. The architecture design of the site must be simple and easy to understand by any designers (from junior developers to intermediate developers) and search engines. In this articleArticle. In the future, this application may be used in large scales around the world.CommunityThe website has added functions and modules. Therefore, the design of the site must be able to easily adapt to the business logic of future growth.
In the first part of the article, I will use this idea to discuss the creation and design of the User Interface UI. The UI will be separated from the business logic and can be created but independent of any designer/developer. In this section, we will use ASP. net mvc, Knockout jquery, and bootstrap. Later in the article, we will discuss the database design and the use of a layered structure to implement business logic. The technologies used include SQL Server 2008, Entity Framework, and Castle Windsor to support dependency injection.
Separation of concerns: Main Goals
The key is to separate most or all of the business logic. The logic should not be bound with the page. What if I re-use the logic on another page? In this way, we can copy and paste. If we do this, the project will become maintainable. Another key point is to separate data access from the business logic. Because we plan to use the entiy framework, this is not a problem because EF has already done so. We can easily transfer our EF files from one project to another, simply adding some necessary references. below is the design diagram.
The final solution is as follows in Visual Studio:
There are 7 projects in the solution. Is it necessary?
The design will bring many advantages, including:
- Separation of focus: clearly stratified means that applications can be separated into independent fields without overlapping functions. For example, UI designers can focus on their work without being affected by business logic (application. Web ).CodeDevelopers only need to process the main business logic (application. DTO or application. Manager ).
- Productivity: You can easily add features to existing software. Because the software structure is in place, the new feature code can be step-by-step. You can easily identify and separate any complicated problems, the quality factors required by software engineering are robustness, adaptability, maintenance, and reuse.
- Maintenance: applications that are easy to maintain and clearly defined structures are easy to understand. It is easy to detect bugs and exceptions, and the risk of modification is minimized.
- Adaptability: new technologies, such as different front-end technologies, or engines that increase business logic, are also easy to achieve. Your application architecture has a clear separation of focus.
- Reusability: For any application design, reusability is an important concern, because it can reduce the total cost of ownership TCO. Our design considers reusing web applications and different layers, later in the article, we will discuss in detail the features in each layer.
Tools and technologies
To achieve the final goal, we need the following tools:
- Visual Studio 2012
- ASP. net mvc 4 with razor view Engine
- Entity Framework 5.0
- Castle Windsor for Di
- SQL Server 2008/2012
- Knockout. JS & jquery
- Castle Windsor for Di
- Bootstrap CSS