SlideShare a Scribd company logo
[MVC – Sfruttare la piattaforma al
            100%]
        [Alessandro Mostarda]
         [sandro1975@fastwebnet.it]
       [www.alessandromostarda.com]




       Web@Work
Web@Work
Agenda

 Model Binding
 Action Filters
 Action Result
 Client & Server validation
Web@Work
Model binding

  • Model binding è il processo di creazione di
    oggetti .NET partendo dai dati inviati dal
    browser in una richiesta HTTP.
  • Viene invocato dopo che è stata individuata la
    action da eseguire
  • Consente di mappare tipi primitivi, oggetti,
    array, collection e files
  • I valori vengono ricavati attraverso
    ValueProvider
Web@Work
Customize Model binding

  • Ereditando da DefaultModelBinder
  • Implementando l’interfaccia IModelBinder
  • Creando un ModelBinderProvider
Web@Work
Action filters

  • Gli action filters consentono di inserire alcuni
    frammenti di logica, non legati ad una singola
    action, ma a più action e/o più controller. In tal
    modo è possibile evitare di ripetere codice
    all’interno delle Action.
  • Sono di 4 tipi: Authorization, Action,
    Result,Exception
  • Si applicano indistintamente a Controller e/o
    Action
Web@Work
Action filters

  • Gli Action Filter vengono eseguiti Subito prima
    e subito dopo l’esecuzione di un Action
    method
  • I Result Filter vengono eseguiti subito prima e
    subito dopo l’esecuzione del metodo execute
    di un Action Result
Web@Work
Customize Action filters

  •   Ereditare da ActionFilterAttribute
  •   Implementare l’interfaccia IActionFilter
  •   Implementare l’interfaccia IResultFilter
  •   Possibilità di registrare un
      ActionFilter/ResultFilter per tutte le action. In
      questo caso parliamo di Global Filters
Web@Work
ActionResult

  • Le ActionResult servono a specificare il modo
    con cui vogliamo rispondere ad una richiesta
    HTTP
  • Sono customizzabili e possono essere usate,
    ad esempio, per generazione di risposte in
    formato di PDF, XML ed etc.
  • La classe di base è ActionResult
  • Ci sono degli helper method nei controller che
    ne facilitano la creazione.
Web@Work
Client & Server side validation

  • La validazione Server deve sempre essere
    presente.
  • Si può fare sfruttando:
   •   Il Model Binding;
   •   La Self Validation (IValidatableObject)
   •   Le Data Annotations
Web@Work
Client & Server side validation

  • La validazione client è facoltativa, ma le
    moderne applicazioni non possono farne a
    meno
  • Per abilitarla occorre utilizzare le Data
    Annotations lato server, implementando però
    anche l’interfaccia IClientValidatable.
  • Sul client è costruita sul plugin JQuery
    Validation
Web@Work
Grazie agli sponsor

More Related Content

PPTX
Web Api – The HTTP Way
Luca Milan
 
PPT
Introduzione a jQuery
Sandro Marcon
 
PPTX
Slide typescript - net campus
DotNetCampus
 
PPTX
Javascript task automation
Antonio Liccardi
 
PDF
Xamarin.Forms Performance Tips & Tricks - Francesco Bonacci - Codemotion Rome...
Codemotion
 
PDF
jQuery
Salvatore Paone
 
PDF
Introduzione a Service Fabric e Actor Model
Andrea Tosato
 
PDF
AntiPatterns: i vizi del programmatore
Manuel Scapolan
 
Web Api – The HTTP Way
Luca Milan
 
Introduzione a jQuery
Sandro Marcon
 
Slide typescript - net campus
DotNetCampus
 
Javascript task automation
Antonio Liccardi
 
Xamarin.Forms Performance Tips & Tricks - Francesco Bonacci - Codemotion Rome...
Codemotion
 
Introduzione a Service Fabric e Actor Model
Andrea Tosato
 
AntiPatterns: i vizi del programmatore
Manuel Scapolan
 

What's hot (20)

PPTX
Actions on Google e Alexa skills per .NET lovers
Lorenzo Giudici
 
PPTX
Soluzioni IoT con le tecnologie Microsoft
Massimo Bonanni
 
PPTX
Async/Await: make it simple!!
Massimo Bonanni
 
PDF
Architetttura Della Soluzione
Luca Milan
 
PDF
ASP.NET Core - dove siamo arrivati
Andrea Dottor
 
PPTX
DotNetCampus - Continuous Integration con Sql Server
Alessandro Alpi
 
PPTX
Del furia signalr-to-the-max
DotNetCampus
 
PPTX
Javascript task automation
DotNetCampus
 
PDF
Training Signal Webtrends
Stefano Iaboni
 
PPTX
Dot netcampus2015 green-template
DotNetCampus
 
PDF
[Alam aeki] Guida illustrata alla modellazione di un dominio con Event Sourci...
Andrea Balducci
 
PPTX
Akka.net & Actor Model
Stefano Del Furia
 
PDF
Managed Extensibility Framework (MEF)
Manuel Scapolan
 
PPTX
ASP.NET MVC 6 - uno sguardo al futuro
Andrea Dottor
 
PDF
ARCHITETTURA DI UN'APPLICAZIONE SCALABILE
DotNetCampus
 
PPTX
2015.04.23 Azure Community Bootcamp 2015 Keynote Italy
Marco Parenzan
 
PPTX
Customize ASP.NET Core scaffolding
Andrea Dottor
 
PPTX
Windows azure - abbattere tempi e costi di sviluppo
Andrea Dottor
 
PPTX
Wcf data services
Salvatore Sorrentino
 
PDF
Dependency injection questa sconosciuta
Andrea Dottor
 
Actions on Google e Alexa skills per .NET lovers
Lorenzo Giudici
 
Soluzioni IoT con le tecnologie Microsoft
Massimo Bonanni
 
Async/Await: make it simple!!
Massimo Bonanni
 
Architetttura Della Soluzione
Luca Milan
 
ASP.NET Core - dove siamo arrivati
Andrea Dottor
 
DotNetCampus - Continuous Integration con Sql Server
Alessandro Alpi
 
Del furia signalr-to-the-max
DotNetCampus
 
Javascript task automation
DotNetCampus
 
Training Signal Webtrends
Stefano Iaboni
 
Dot netcampus2015 green-template
DotNetCampus
 
[Alam aeki] Guida illustrata alla modellazione di un dominio con Event Sourci...
Andrea Balducci
 
Akka.net & Actor Model
Stefano Del Furia
 
Managed Extensibility Framework (MEF)
Manuel Scapolan
 
ASP.NET MVC 6 - uno sguardo al futuro
Andrea Dottor
 
ARCHITETTURA DI UN'APPLICAZIONE SCALABILE
DotNetCampus
 
2015.04.23 Azure Community Bootcamp 2015 Keynote Italy
Marco Parenzan
 
Customize ASP.NET Core scaffolding
Andrea Dottor
 
Windows azure - abbattere tempi e costi di sviluppo
Andrea Dottor
 
Wcf data services
Salvatore Sorrentino
 
Dependency injection questa sconosciuta
Andrea Dottor
 
Ad

Viewers also liked (20)

PPTX
ALM Revolutions - Process Template Customization
DomusDotNet
 
PPTX
Tecniche innovative di marketing via web
Marko Petelin
 
PPTX
ALM Revolutions - Non si vive di solo check-out e check-in
DomusDotNet
 
DOC
Pbb1
Bayu Yuya
 
PPT
Ppt clothes
thediplomados
 
PPT
Tubia method music therapy13pp
Tubiamethod
 
PPTX
ALM@Work - Lab management for everyone
DomusDotNet
 
PPTX
ALM@Work - Typical developer day
DomusDotNet
 
PPT
Tubia method music therapy13pp
Tubiamethod
 
PPTX
ALM@Work - Team collaboration with visual studio alm 2012
DomusDotNet
 
PPTX
ALM@Work - Unit testing in Visual studio 2012
DomusDotNet
 
PPTX
Application lifecycle management ... e quindi
DomusDotNet
 
PDF
Jerome Cultrera for Nylon
SEE Management
 
PPT
Payan Amistad
nicaragua18
 
PPS
Para pensarlo
Gerardo Ceseñas Arroyo
 
DOCX
Resume INTERNSHIP
Giovanni Lauretta
 
PPS
Porto Belo
Ari Alves
 
PPT
Edificacion sostenibilidad
aidamacias
 
PPS
Roberto rincon
Roberto Rincon
 
PDF
22º dia pdf
Rodrigo Brito
 
ALM Revolutions - Process Template Customization
DomusDotNet
 
Tecniche innovative di marketing via web
Marko Petelin
 
ALM Revolutions - Non si vive di solo check-out e check-in
DomusDotNet
 
Pbb1
Bayu Yuya
 
Ppt clothes
thediplomados
 
Tubia method music therapy13pp
Tubiamethod
 
ALM@Work - Lab management for everyone
DomusDotNet
 
ALM@Work - Typical developer day
DomusDotNet
 
Tubia method music therapy13pp
Tubiamethod
 
ALM@Work - Team collaboration with visual studio alm 2012
DomusDotNet
 
ALM@Work - Unit testing in Visual studio 2012
DomusDotNet
 
Application lifecycle management ... e quindi
DomusDotNet
 
Jerome Cultrera for Nylon
SEE Management
 
Payan Amistad
nicaragua18
 
Resume INTERNSHIP
Giovanni Lauretta
 
Porto Belo
Ari Alves
 
Edificacion sostenibilidad
aidamacias
 
Roberto rincon
Roberto Rincon
 
22º dia pdf
Rodrigo Brito
 
Ad

Similar to ASP.NET MVC: sfruttare la piattaforma al 100% (20)

PPTX
ASP.NET MVC: Andare oltre il 100% (Web@work)
Giorgio Di Nardo
 
PPTX
Asp.net web form 4.5 - what's new!!
Massimo Bonanni
 
PPTX
ASP.NET Web API
Pietro Libro
 
PPT
What's New in ASP.NET 4.5 and Visual Studio 2012
Andrea Dottor
 
PDF
Tutte le novità di ASP.NET MVC3
Manuel Scapolan
 
PPSX
Asp.Net MVC 3 - Il Model View Controller secondo Microsoft
Stefano Benedetti
 
PPTX
Inversion of Control @ CD2008
Mauro Servienti
 
PPTX
Silverlight m v-vm @ DotNetteria
Mauro Servienti
 
PPTX
We Want Web - Web Applications con MVC 3
DomusDotNet
 
PPT
SUE AGILE Framework (Italiano)
Sabino Labarile
 
PPTX
ASP.NET MVC 3: se non ora, quando?
Giorgio Di Nardo
 
PDF
ASP.NET MVC: Full Throttle
Andrea Saltarello
 
PPTX
ASP.NET MVC
Raffaele Fanizzi
 
PPTX
Asp.Net MVC 2 :: VS 2010 Community Tour
Andrea Balducci
 
PPTX
Novità di Asp.Net 4.0
Gian Maria Ricci
 
PPTX
Brokering over WCF @ dotNetMarche
Mauro Servienti
 
PPT
Sviluppo Web Agile con Castle Monorail
DotNetMarche
 
PDF
Niccolò Becchi: Introduzione a GWT
firenze-gtug
 
PPTX
Introduzione a Workflow Foundation
DotNetMarche
 
PPTX
.Net 4.0 Preview @ UGIdotNet
Mauro Servienti
 
ASP.NET MVC: Andare oltre il 100% (Web@work)
Giorgio Di Nardo
 
Asp.net web form 4.5 - what's new!!
Massimo Bonanni
 
ASP.NET Web API
Pietro Libro
 
What's New in ASP.NET 4.5 and Visual Studio 2012
Andrea Dottor
 
Tutte le novità di ASP.NET MVC3
Manuel Scapolan
 
Asp.Net MVC 3 - Il Model View Controller secondo Microsoft
Stefano Benedetti
 
Inversion of Control @ CD2008
Mauro Servienti
 
Silverlight m v-vm @ DotNetteria
Mauro Servienti
 
We Want Web - Web Applications con MVC 3
DomusDotNet
 
SUE AGILE Framework (Italiano)
Sabino Labarile
 
ASP.NET MVC 3: se non ora, quando?
Giorgio Di Nardo
 
ASP.NET MVC: Full Throttle
Andrea Saltarello
 
ASP.NET MVC
Raffaele Fanizzi
 
Asp.Net MVC 2 :: VS 2010 Community Tour
Andrea Balducci
 
Novità di Asp.Net 4.0
Gian Maria Ricci
 
Brokering over WCF @ dotNetMarche
Mauro Servienti
 
Sviluppo Web Agile con Castle Monorail
DotNetMarche
 
Niccolò Becchi: Introduzione a GWT
firenze-gtug
 
Introduzione a Workflow Foundation
DotNetMarche
 
.Net 4.0 Preview @ UGIdotNet
Mauro Servienti
 

More from DomusDotNet (10)

PPTX
Unit testing in Visual Studio 2013
DomusDotNet
 
PPTX
Advanced ef code first 5.0 - EF@work
DomusDotNet
 
PPTX
Push Notification, Live Tile e Background Agent
DomusDotNet
 
PDF
Sviluppare per Intel® Ultrabook™
DomusDotNet
 
PPTX
ALM@Work - Continuous delivery 101
DomusDotNet
 
PPTX
WeWantWeb - WCF Data Services
DomusDotNet
 
PPTX
ALM Revolutions - What's new in visual studio ALM 11
DomusDotNet
 
PDF
Pomeriggio Entity Framework - WP7 e SQL Compact Edition
DomusDotNet
 
PPTX
Pomeriggio Entity Framework - Database First
DomusDotNet
 
PPTX
Pomeriggio Entity Framework - Code First
DomusDotNet
 
Unit testing in Visual Studio 2013
DomusDotNet
 
Advanced ef code first 5.0 - EF@work
DomusDotNet
 
Push Notification, Live Tile e Background Agent
DomusDotNet
 
Sviluppare per Intel® Ultrabook™
DomusDotNet
 
ALM@Work - Continuous delivery 101
DomusDotNet
 
WeWantWeb - WCF Data Services
DomusDotNet
 
ALM Revolutions - What's new in visual studio ALM 11
DomusDotNet
 
Pomeriggio Entity Framework - WP7 e SQL Compact Edition
DomusDotNet
 
Pomeriggio Entity Framework - Database First
DomusDotNet
 
Pomeriggio Entity Framework - Code First
DomusDotNet
 

ASP.NET MVC: sfruttare la piattaforma al 100%

  • 1. [MVC – Sfruttare la piattaforma al 100%] [Alessandro Mostarda] [[email protected]] [www.alessandromostarda.com] Web@Work
  • 2. Web@Work Agenda Model Binding Action Filters Action Result Client & Server validation
  • 3. Web@Work Model binding • Model binding è il processo di creazione di oggetti .NET partendo dai dati inviati dal browser in una richiesta HTTP. • Viene invocato dopo che è stata individuata la action da eseguire • Consente di mappare tipi primitivi, oggetti, array, collection e files • I valori vengono ricavati attraverso ValueProvider
  • 4. Web@Work Customize Model binding • Ereditando da DefaultModelBinder • Implementando l’interfaccia IModelBinder • Creando un ModelBinderProvider
  • 5. Web@Work Action filters • Gli action filters consentono di inserire alcuni frammenti di logica, non legati ad una singola action, ma a più action e/o più controller. In tal modo è possibile evitare di ripetere codice all’interno delle Action. • Sono di 4 tipi: Authorization, Action, Result,Exception • Si applicano indistintamente a Controller e/o Action
  • 6. Web@Work Action filters • Gli Action Filter vengono eseguiti Subito prima e subito dopo l’esecuzione di un Action method • I Result Filter vengono eseguiti subito prima e subito dopo l’esecuzione del metodo execute di un Action Result
  • 7. Web@Work Customize Action filters • Ereditare da ActionFilterAttribute • Implementare l’interfaccia IActionFilter • Implementare l’interfaccia IResultFilter • Possibilità di registrare un ActionFilter/ResultFilter per tutte le action. In questo caso parliamo di Global Filters
  • 8. Web@Work ActionResult • Le ActionResult servono a specificare il modo con cui vogliamo rispondere ad una richiesta HTTP • Sono customizzabili e possono essere usate, ad esempio, per generazione di risposte in formato di PDF, XML ed etc. • La classe di base è ActionResult • Ci sono degli helper method nei controller che ne facilitano la creazione.
  • 9. Web@Work Client & Server side validation • La validazione Server deve sempre essere presente. • Si può fare sfruttando: • Il Model Binding; • La Self Validation (IValidatableObject) • Le Data Annotations
  • 10. Web@Work Client & Server side validation • La validazione client è facoltativa, ma le moderne applicazioni non possono farne a meno • Per abilitarla occorre utilizzare le Data Annotations lato server, implementando però anche l’interfaccia IClientValidatable. • Sul client è costruita sul plugin JQuery Validation