Contenu connexe Similaire à DotNed MVC4 (20) DotNed MVC42. Simplicity
18 jaar ervaring in software development
ondernemer in ICT sinds 1997
IfSQ Fellow / boardmember
Developer
Coach
Trainer
Focus op kwaliteit en productiviteit
10. • IoC
• Custom filters
• DefaultControllerFactory
• IDependencyResolver
• ExportProvider (web.config appsettings ie)
• IActionInvoker
19. • Routes.Ignore
• Routing table
• Constraints
• HttpMethodConstraint
• Custom: IRouteConstraint
• IRouteHandler
• Attribute based routing
• Glimpse
21. • ScriptBundle & StyleBundle classes
– Release vs debug mode
• BundleTable.EnableOptimizations = true
22. Synchronous actions:
• Simple and short-running operations
• Simplicity over efficiency
• CPU-intensive operations
Asynchronous:
• Long-running operations
• Network- or I/O-intensive operations
• Cancellation options required
23. • New features due to async & await pattern
• Better support then ASP.NET 2.0 async:
AddOnPreRenderCompleteAsync(
new BeginEventHandler(MyBeginMethod),
new EndEventHandler(MyEndMethod)
)
25. public async Task<ActionResult> SearchForBids(string Id)
{
var bids = await Search(Id);
return Json(bids, JsonRequestBehavior.AllowGet);
}
private async Task<IEnumerable<Bid>> Search(string Id)
{
var bids = _repository
.Query<Bid>(x => x.Timestamp >= startingRange
&& x.Timestamp <= endingRange)
.OrderByDescending(x => x.Timestamp).ToList();
return bids;
}
28. • ClientDisconnectedToken and TimedOutToken
public override Task ProcessRequestAsync(HttpContext context)
{
CancellationTokenSource cancellationTokenSource =
CancellationTokenSource.CreateLinkedTokenSource(
context.Request.TimedOutToken,
context.Response.ClientDisconnectedToken);
}
31. HTTP/1.1 200 OK
Date: Mon, 18 Jun 2012 21:22:33 GMT
X-AspNet-Version: 4.0.30319
Set-Cookie: .ASPXAUTH={authentication-token}; path=/; secure; HttpOnly;
{ Cache-Control, Content-Type, Location, Server and other keys/values not
listed. }
POST /DoTransfer HTTP/1.1
Host: WoodgroveBank.com
Content-Type: application/x-www-form-urlencoded
Cookie: .ASPXAUTH={authentication-token}
toAcct=12345&amount=1,000.00
32. POST /DoTransfer HTTP/1.1
Host: WoodgroveBank.com
Content-Type: application/x-www-form-urlencoded
Cookie: .ASPXAUTH={authentication-token}
toAcct=67890&amount=250.00
33. • <httpRuntime requestValidationMode="4.5” />
• <httpRuntime
encoderType="System.Web.Security.AntiXss.AntiXssEncoder,System.
Web, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
• [AntiForgeryToken]
Notes de l'éditeur START MINIMAL DEMO This is the complete ‘normal’ stack Bundle in release = 1 file, debug = separate files In page @Async=“true” beforeasync & await pattern -> otherwise Exception!