Globalcode – Open4education
As novidades do ASP.NET MVC 3Victor Cavalcante
Arquiteto de Software/Agile Coach – Stefanini
@vcavalcante
Globalcode – Open4education
Agenda
Novidades do ASP.NET MVC 3
Globalcode – Open4education
O que preciso saber?
27/07/2010 lançado o Preview 1 do ASP.NET MVC 3
Download em: http://tinyurl.com/aspnetmvc3p1
Compatível com ASP.NET MVC 2
Funciona lado a lado com ASP.NET MVC 2
Somente acrescenta funcionalidades
Globalcode – Open4education
Novidades
Nova caixa de diálogo para adicionar View
Globalcode – Open4education
Novidades - Razor
Nova View Engine
Compacta e Expressiva
Fácil de aprender
Não é uma linguagem
Funciona em qualquer editor
Habilita Test Unitário na View
Por enquanto só C#
Intellissense?
Colorização do código?
Globalcode – Open4education
Demo - Razor
Globalcode – Open4education
Futuro – Preview 2?
Globalcode – Open4education
Filtros Globais
Possibilidade de aplicar um filtro globalmente
Para todos os Controllers da sua aplicação
Definido no Global.asax
Globalcode – Open4education
Demo
Globalcode – Open4education
Novo Dynamic ViewModel
ViewModel é uma propriedade do Controller que é do tipo Dynamic
Internamente o dado continua na ViewData
Globalcode – Open4education
Demo
Globalcode – Open4education
ActionResult Types
Possibilidade de retornar o código http correto de forma fácil.
Action Result Types
HttpNotFoundResult404
HttpRedirectResult302
RedirectPermanent301
RedirectToRoutePermanent301
RedirectToActionPermanent301
HttpStatusCodeResult
customizado
Globalcode – Open4education
ActionResult Helpers
Globalcode – Open4education
JavaScript
Possibilidade de receber como input um JSON
DataBind diretamente de um JSON
Previsto melhor suporte a unobstrusive JavaScript
Inclusão do jquery.validate.js no projeto (não integrado ainda)
Globalcode – Open4education
Demo
Globalcode – Open4education
Injeção de Dependência
Estrutura do MVC:
ControllerBuilder
ControllerFactory
Controller
ViewEngine
View
ControllerActionInvoker
ActionResult
ActionFilters
Model Binders
Globalcode – Open4education
Injeção de Dependência
AgoraControllers (registering & injecting controller factories, injecting controllers)
Views (registering & injecting view engines, injecting dependencies into view pages)
Action Filters (locating & injecting filters)
FuturoModel Binders (registering & injecting)
Value Providers (registering & injecting)
Validation Providers (registering & injecting)
Model metadata Providers (registering & injecting)
Globalcode – Open4education
Common Service Locator
Interface Comum para todos os containers
http://commonservicelocator.codeplex.com/
Será incluído no ASP.NET MVC 3
Globalcode – Open4education
Links
http://weblogs.asp.net/scottguportuguese/archive/2010/07/27/apresentando-a-asp-net-mvc-3-amostra-1.aspx
http://aspnet.codeplex.com/releases/view/50092#DownloadId=140348
http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx
http://weblogs.asp.net/jacqueseloff/archive/2010/07/30/mvc-3-supporting-custom-view-engines.aspx
Globalcode – Open4education
Links
http://www.viddler.com/explore/mvcconf/videos/4/
http://blog.devlpr.net/2010/07/27/asp-net-mvc-3-new-features-in-preview-1/
http://www.michaelhamrah.com/blog/2010/08/the-new-webapp-architecture-asp-net-mvc-3-jquery-templating-with-pure-and-the-json-value-provider/
http://bradwilson.typepad.com/blog/2010/07/service-location-pt1-introduction.html
Globalcode – Open4education
Dúvidas?
Globalcode – Open4education22
Top Related