Mvc4 Intro

23
ASP.NET MVC 4 OPTA II

description

Introducción a MVC4

Transcript of Mvc4 Intro

Page 1: Mvc4 Intro

ASP.NET MVC 4OPTA II

Page 2: Mvc4 Intro

MVC4

ASP.NET MVC es un framework de desarrollo web en la plataforma .NET con un enfoque en código limpio, separación de responsabilidad (concerns) y facilidad para probar.

Page 3: Mvc4 Intro

MVC4

MVC4 trabaja con .NET4 y .NET4.5

En MVC no se trabaja alrededor de paginas ASPX, controles, postbacks, viewstatus u otros eventos del ciclo de vida de una pagina;

En lugar de ello se definirán controladores, acciones y vistas.

Page 4: Mvc4 Intro

MVC4 – Patron MVC

MVC proviene de Model View Controller, un patron de diseno que es

muy popular en el desarollo web.

Page 5: Mvc4 Intro

MVC4 – Model

MODEL

Business Logic.

El dominio en el que el software esta construido.

Page 6: Mvc4 Intro

MVC4 – View

VIEW

UI Logic

La representacion visual del modelo, en un contexto especifico.Usualmente es el markup resultante que se renderiza al browser.

Page 7: Mvc4 Intro

MVC4 – Controller

CONTROLLER

Input Logic

El coordinador que provee el enlace entre la vista y el modelo. El controlador es responsable por procesar las entradas, actuar sobre el modelo y decidir que accion debera ser realizada.

Page 8: Mvc4 Intro

MVC4 – Patron MVC

Page 9: Mvc4 Intro

MVC4 – Nuevo en ASP.NET MVC3/4

.NET 4 Razor view engine Package management with NuGet Improved extensibility Global action filters Dynamic language features Partial page output caching Ajax improvements Enhancements to the validation infrastructure Mobile templates Web API

Page 10: Mvc4 Intro

MVC4 – Razor View Engine

Una de las partes clave de las nuevas tecnologias ASP.NET

Provee una manera concisa de mezclar codigo y markup dentro del mismo archivo.

Page 11: Mvc4 Intro

MVC4 – comparacion de View Engines

Web Forms view engine <%@ Page Language="C#"

Inherits="System.Web.Mvc.ViewPage<Product[]>" %>

<ul>

<% foreach(var product in Model) { %>

<li><%: product.Name %></li>

<% } %>

</ul>

Page 12: Mvc4 Intro

MVC4 – comparacion de View Engines

Razor View Engine @model Product[]

<ul>

@foreach(var product in Model) {

<li>@product.Name</li>

}

</ul>

Page 13: Mvc4 Intro

MVC4- Ambiente de desarollo

Visual Studio 2010SP1/2012

MVC4 : disponible en

Web Platform Installer:http://www.asp.net/mvc

Page 14: Mvc4 Intro

MVC4- Crear un nuevo proyecto

File>New Project>Visual C#> Web>ASP.NET MVC4 Web application

Selecciona Razor Engine y Internet application.

Selecciona OK.

Page 15: Mvc4 Intro

MVC4- Crear un nuevo proyecto

Page 16: Mvc4 Intro

MVC4- Estructura de un proyecto

Page 17: Mvc4 Intro

MVC4 – Agregar el modelo

Page 18: Mvc4 Intro

MVC4 – Stub de persistencia

Page 19: Mvc4 Intro

MVC4 - Agregar Controller

Page 20: Mvc4 Intro

MVC4 – Agregar Views

Page 21: Mvc4 Intro

MVC4 – Agregar Views

Page 22: Mvc4 Intro

Otros recursos..

http://www.asp.net/mvc/overview/getting-started

http://pluralsight.com/training/players/PSODPlayer?author=scott-allen&name=mvc3-building-intro&mode=live&clip=0&course=aspdotnet-mvc3-intro

ASP.NET MVC4 In Action MVC MovieAPP tutorial (CRUD app )

http://www.asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/cs/intro-to-aspnet-mvc-3

Page 23: Mvc4 Intro

Basado en el libro :ASP.NET MVC4 In Action