Upload
jesus-angulo
View
2.010
Download
0
Tags:
Embed Size (px)
Citation preview
ASP.net MVC 4 con C#Jesus AnguloMCTS & MSP Facebook.com/jesuslink2514Twitter.com/jesulink2514
Agenda9. Controlando Urls con Routing9.1 Url schema9.2 Debugging routes9.3 Testing routes
10. Model Binders y Value Providers10.1 El pipeline de ejecución en MVC10.2 Creando un model binder personalizado10.3 Creando un value provider personalizado
RountingAjax
Routing• Todo lo que
tienen que ver con la manera en la que las peticiones web se mapean a controladores y como el framework mvc construye rutas para links y peticiones Ajax
La Ruta por defecto
{controller}/{action}/{id}
Controller=Home,Action = Index,
Id= UrlPatameter.Optional
Routing~/books/details/4
public class BooksController:Controller{
public ActionResult Details(int id){
….}
}
Consejos para Diseñar un Esquema de Rutas Hacer rutas simples y limpias Hacer url hackeables Difereciar peticiones usando parametros de Url
Evitar exponer ID’s de base de datos innecesariamente
Considerar agregar informacion innecesaria
DEMO
Esquemas de Rutas
Construcción y depuración de Rutas
Model Binders y Value Providers
Asp.net MVC
MVC Pipeline
MVC Pipeline
Model Binder• Es el mecanismo por el
cual MVC transforma los datos provenientes de los formularios, cookies , variables de Session ,querystring ,etc en objetos con los que podamos trabajar mas cómodamente.
DEMO
Model Binders
Custom Model Binder con Entity Framework
© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Gracias ! Hasta el próximo capítulo
/jesulink2514
/jesulink2514Domingo 19 de Enero
AutoMapper y Controladores Ligeros