Lesson 1: Overview of Microsoft Web Technologies
Lesson 1: Overview of Microsoft Web Technologies
NET MVC 4
Lesson 1: Overview of Microsoft Web Technologies
Lesson 2 Overview of ASP.NET 4.5
Web Pages Web Forms
Designing Views
Template views in ASP.NET MVC web applications perform
the same role as master pages in ASP.NET Web Forms
applications
Controller View
Using Display and Edit Data Annotations on Validating User Input with Data Annotations
Properties
Strongly-Typed Views
2. Phase 2: A developer modifies the Index action so that it returns a partial view. The developer renames the action _Index to
conform to the team’s partial view naming convention. The test fails because the name has changed. The developer modifies the
test so that it calls the renamed action and the test passes.
3. Phase 3: A developer modifies the Index action by writing a different Language Integrated Query (LINQ) query to implement a
new functional requirement. However, the developer makes a mistake in the LINQ query. The Index action now returns zero
products whatever integer is passed as a parameter. The test fails.
Writing Loosely Coupled MVC Components Writing Unit Tests for MVC Components
Using Mocking Frameworks
Site Menus
Tree Views
Breadcrumb Trails
Instead of
http://site/Furnace/Details/23
use
http://site/OilFired/HotBurner2000
1. An MvcHandler object creates a controller factory. The controller factory is the object that
instantiates a controller to respond to the request.
2. The controller factory consults the routing table to determine the right Controller class to use.
3. The controller factory creates a Controller object, and the MvcHandler calls the Execute method in
that controller.
4. The ControllerActionInvoker examines the request URL and consults the routing table to determine
the action in the Controller object to call.
5. The ControllerActionInvoker uses a model binder to determine the values that should be passed to
the action as parameters. The model binder consults the routing table to determine if any segments
of the URL should be passed as parameters. The model binder can also pass parameters from a
posted form, from the URL query text, or from uploaded files.
6. The ControllerActionInvoker runs the action. Often, the action creates a new instance of a model
class, perhaps by querying the database with the parameters that the invoker passed to it. This model
object is passed to a view, to display results to the user.
Adding and Configuring Routes Using Routes to Pass Parameters
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.js"
type="text/javascript"></script>
<script
src="http://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.unobtrusiveajax
.
min.js" type="text/javascript"></script>
</head>
<body>
<div>
<div id="divMessage">@ViewBag.Message</div>
@Ajax.ActionLink("Refresh","HelloWorld", new AjaxOptions{
HttpMethod =
"POST", UpdateTargetId = "divMessage", InsertionMode =
InsertionMode.Replace })
</div>
</body>
</html>
Lesson 2 Implementing a Caching Strategy
The output cache