Now whether it is a business or research institutions, almost all project development is to follow a certain framework, will be proven in the development framework and development model used for reference, but inevitably encounter some functional implementation or based on some consideration of the current development framework can not achieve such a goal. Then we will consider the integration of different technologies.
We are now developing the platform project is to learn from this idea, our platform project first the overall development framework of the use of the AspNet MVC framework; Second, the data access layer applies the CommunityServer development framework, which incorporates the provider model and the traditional three-tier architecture. In business logic layer processing, we introduce dependency injection (DI) in order to ensure the reusability and scalability of the code, and finally, we use Rhino mocks as our test framework in the Unit test module.
(i) the AspNet MVC framework, the so-called MVC, is actually three words model, view and controller respectively. To understand the meaning of their differences, we start from the asp.net page processing mechanism.
Generally speaking, a asp.net page usually has to deal with things: 1. Because the last show is the page, so we want to get on the page to show the required data, that is model. 2. To bind data to our page controls in the Page_Load (page load) method of the page, the work involved in these business logic (that is, getting data and binding data) is done in Conotroller. 3. The. aspx page that we see, the difference is that these pages are not background. CS code class.
Next we need to understand the process of Web requests in MVC, where the user sends a URL request to the server through a Web browser, where the requested URL is no longer a xxx.aspx format, but a http://HostName/ControllerName/ The format of the actionname/parameters. This request was intercepted by ASP.net MVC's routing mapping System (routing mappings can be configured in Global.asax). According to the mapping rules, the Routing Mapping system resolves the controller name Controllername,action name actionname and each parameter parameters, and then looks for the controllers directory ControllerNameController.cs this controller class, by default, the system always looks for a class named "Controller name +controller" Under the Controllers directory, and then searches for a method under this class that has the same name as ActionName. When found, the parameters is passed as an argument to this method, and then the action method begins execution, returns to the corresponding view when it is finished, and by default returns an ASPX file with the same name as ActionName under the same directory as Controllername , and passes ViewData to the view. The viewdata typically includes control of the control view display and the data needed for the view display, as shown in Figure 1.