Microsoft Web Development Platform
MVC Architecture
goal : Implement isolation between application modules (that is, separation of concerns)
Benefits : When developing-individual components are not dependent on other components, can be deployed independently, or can be replaced; reducing the impact between components
Test-The code can replace real product components, reduce the number of direct calls to the database, and streamline the real-world testing process of the system.
Maintenance-Small impact
split the application into 3 layers : View, model, controller
MVC4 new Features
asynchronous controllers : Avoid long-time exclusive resources and better process long-time requests.
display Mode : Provides a way to display different devices.
binding and compression : Improves user experience and reduces download time for various resources.
Create a template to create a project introduction
Empty template : Create a schema for the MVC4 Web site (containing the folder structure, as well as some necessary assembly references)
Basic Template : Create a folder structure according to MVC4 rules
Internet Application Templates : Empty templates are expanded to include simple default controllers, account controllers together with some basic logic code and default view files
Ethernet Application Templates : Similar to Internet templates, using the Windows-based authentication mechanism (the selected mechanism for enterprise LAN full authentication)
Mobile Application Templates : A variant of the Internet application template. Optimized for mobile devices.
Web Api: is a variant of the Internet application template. Pre-defined Web Api (a lightweight RESTful HTTP Web service Framework) controller
Concept
Custom Precedence Principle : Create a project by following a specific convention rather than a configuration file
program Run :
Routing :
To Configure routing :
Controller :
Responds to the user's input and coordinates the model, view, and data access layer.
operation result : Free to decide as needed
Content (): Returns the Contentresult of the text type, such as "hello,world! ”
File (): Returns the contents of the type Fileresult, such as PDF
Httpnotfound (): Returns the Httpnotfoundresult that contains the 404HTTP status code
JavaScript (): Returns a javascriptresult containing JavaScript content, such as "function Hello () {alert (' hello,world! ');}"
JSON (): Returns the Jsonresult of JSON-formatted data, such as "{" "Message": "Hello,world!"} "
Partialview (): Returns the Partialviewresult that contains the contents of the partial view
Redirect (): Returns a value that contains the 302 jump status Redirectresult, jumps to the given URL
Redirecttoaction () and Redirecttoroute (): Similar to redirect (), only the framework can dynamically query the routing engine to determine the external URL.
View (): Returns the Viewresult of the rendered view
operation parameters : have "model binding" function, get parameters do not need to parse the request object, directly corresponding function parameters on the line.
Action Filters : Inject logic at specific points to help address crosscutting concerns across modules throughout the program
Lightweight Rights Management System--MVC Foundation