14
ASP.ne t MVC 4 con C# Jesus Angulo MCTS & MSP Facebook.com/jesuslink2514 Twitter.com/jesulink2514

Capitulo 09-10

Embed Size (px)

Citation preview

Page 1: Capitulo 09-10

ASP.net MVC 4 con C#Jesus AnguloMCTS & MSP Facebook.com/jesuslink2514Twitter.com/jesulink2514

Page 2: Capitulo 09-10

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

Page 3: Capitulo 09-10

RountingAjax

Page 4: Capitulo 09-10

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

Page 5: Capitulo 09-10

La Ruta por defecto

{controller}/{action}/{id}

Controller=Home,Action = Index,

Id= UrlPatameter.Optional

Page 6: Capitulo 09-10

Routing~/books/details/4

public class BooksController:Controller{

public ActionResult Details(int id){

….}

}

Page 7: Capitulo 09-10

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

Page 8: Capitulo 09-10

DEMO

Esquemas de Rutas

Construcción y depuración de Rutas

Page 9: Capitulo 09-10

Model Binders y Value Providers

Asp.net MVC

Page 10: Capitulo 09-10

MVC Pipeline

Page 11: Capitulo 09-10

MVC Pipeline

Page 12: Capitulo 09-10

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.

Page 13: Capitulo 09-10

DEMO

Model Binders

Custom Model Binder con Entity Framework

Page 14: Capitulo 09-10

© 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