SlideShare a Scribd company logo
Alex Thissen
Lead Consultant Xpirit
ASP.NET MVC 6
A new unified programming model for the web
Agenda
• Short overview ASP.NET 5
• A unified programming model
• Controllers
• Dependency Injection
• Routing
• Summary
• Questions and Answers
An overview
Viewing from 10.000 feet
ASP.NET components
MVC 6
Unified Web Stack
Characteristics of MVC 6
•One set of concepts – remove duplication
•Web UI and APIs combined
•Smooth transition from Web Pages to MVC
Unified
•Run on IIS or self-host or cross-platform
•Based on new request pipeline in ASP.NET 5
•Runs in cloud-optimized Core CLR
Built on top
of ASP.NET 5
•Pay as you use
•Middleware
•Built with Dependency Injection first
Modular
Getting familiar
.NET Framework vNext
Full .NET CLR
• Entire API set in machine
wide install at 200 MB
• Updated with OS
• Ecosystem of existing
packages
• Backward compatibility
• Default for
Visual Studio 2015 projects
Cloud Optimized CLR
• Lean and modular runtime
• Optimized for server
• Small memory footprint
• Libraries in NuGet packages
• Framework deployed with
app
• Different versions can run
side-by-side
• 11 MB
Mono
• Cross-Platform runtime for
Linux and Mac OS X
• Together with Mono
community
Standing on the shoulders of a new giant
ASP.NET 5.0 ASP.NET 5.0 ASP.NET 5.0
Getting started
• Middleware model introduced by OWIN
Ready, set, start – a lap around MVC 6
Middleware conceptually
• Middleware stack
• Static files
• Security, authentication,
CORS
• Diagnostics, logging
• Other cross-cutting concerns
Host process and server
Application and framework
RequestDelegate
delegate Task
RequestDelegate(HttpContext
context);
public void Configure(IApplicationBuilder app)
{
app.Map("/Nancy",
builder =>
{ builder.UseRuntimeInfo();
builder.RunNancyFx();
});
app.UseCors();
app.UseMvc(cfg);
Use, Map and Run
app.UseErrorPage();
Application FX
Middleware
Controllers
• Single base class for
MVC and Web API
• Not required
• POCO Controllers
• No base class
• Combine Web API and
MVC in 1 class
• UI and REST endpoints
at one base URI
Not your typical gaming gear
Dependency Injection
It all depends
Dependency Injection
• DI is core part of runtime
• Built-in DI for configuration and services
– Default lightweight version available
• Wire up your own favorite IoC container ...
– Autofac, Ninject, StructureMap, Unity, Castle Windsor
public void ConfigureServices(IServiceCollection services)
{
// Add EF services to the services container.
services.AddEntityFramework(Configuration)
.AddSqlServer()
.AddDbContext<ApplicationDbContext>();
Built-in DI Container
• Register mappings in ConfigureServices of Startup
• Default registrations
• Lifetimes
– Transient
– Scoped
– Singleton
– Instance
• Rules for registering mapping
– First one wins
– Allows you to get ahead off default mappings
Sometimes better is worse than good enough
Activation
Activation method Example
Constructor on classes MyController(ILog logger)
Attribute on field or
property
[Activate]
ILog Logger { get;set; }
Attribute in action [FromServices] ILog logger
Directive in Razor page ILog logger
Inject those objects
@inject
Tag Helpers
• Allow server-side code to participate in rendering of
HTML elements in Razor files
• Target HTML elements based on element and attribute
names
• Reduce explicit transitions between HTML and C#
• Take advantage of composition and tooling benefits in
Visual Studio Code and 2015
Getting some help in Razor
Custom Tag Helpers
namespace TechDays.TagHelpers
{
[TargetElement("datumtijd")]
public class DateTimeTagHelper : TagHelper
{
public override void Process(TagHelperContext context,
TagHelperOutput output) {
output.Content.SetContent(DateTime.Now.ToString());
}
}
}
// Inside Razor .cshtml file
@addTagHelper "*, TechDays.TagHelpers"
Routing
• Familiar MVC 5 attribute based routing
• Enabled by default
• Special tokens: [controller] and [action]
Show me the way
[Route("api/Hello")]
public class HelloController : Controller
{
[Route]
public string Get()
{
return "hello";
}
}
[Route("api/[controller]")]
public class HelloController : Controller
{
[Route]
public string Get()
{
return "hello";
}
}
View components
• Comparable to Web Forms’ UserControls
• Different from Partial Views
• Combines code and view as logical unit
User controls in MVC style
Logging
• Pluggable logging infrastructure provided
• ILoggerFactory
• Logging levels
– from Debug up to Criticial
Summary
• Unified programming model
• Built on ASP.NET 5
• Learn Dependency Injection
• Command-line vs. Visual Studio
Key takeaways from ASP.NET MVC 6
Your feedback is important!
Scan the QR Code and let us know via the TechDays App.
Laat ons weten wat u van de sessie vindt!
Scan the QR Code via de TechDays App.
Bent u al lid van de Microsot Virtual Academy?! Op MVA kunt u altijd iets
nieuws leren over de laatste technologie van Microsoft. Meld u vandaag aan
op de MVA Stand. MVA biedt 7/24 gratis online training on-demand voor IT-
Professionals en Ontwikkelaars.
MVC 6 - the new unified Web programming model

More Related Content

What's hot

Tokyo azure meetup #12 service fabric internals
Tokyo azure meetup #12   service fabric internalsTokyo azure meetup #12   service fabric internals
Tokyo azure meetup #12 service fabric internals
Tokyo Azure Meetup
 
Grails in the Cloud (2013)
Grails in the Cloud (2013)Grails in the Cloud (2013)
Grails in the Cloud (2013)
Meni Lubetkin
 
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
Red Hat Developers
 
Data stores: beyond relational databases
Data stores: beyond relational databasesData stores: beyond relational databases
Data stores: beyond relational databases
Javier García Magna
 
Node and Micro-Services at IBM
Node and Micro-Services at IBMNode and Micro-Services at IBM
Node and Micro-Services at IBM
Dejan Glozic
 
Who needs containers in a serverless world
Who needs containers in a serverless worldWho needs containers in a serverless world
Who needs containers in a serverless world
Matthias Luebken
 
How Apache Kafka® Works
How Apache Kafka® WorksHow Apache Kafka® Works
How Apache Kafka® Works
confluent
 
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Red Hat Developers
 
How Class Data Sharing Can Speed up Your Jakarta EE Application Startup
How Class Data Sharing Can Speed up Your Jakarta EE Application StartupHow Class Data Sharing Can Speed up Your Jakarta EE Application Startup
How Class Data Sharing Can Speed up Your Jakarta EE Application Startup
Rudy De Busscher
 
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at UberWSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
WSO2
 
Gradual migration to MicroProfile
Gradual migration to MicroProfileGradual migration to MicroProfile
Gradual migration to MicroProfile
Rudy De Busscher
 
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
João Pedro Martins
 
Cloudsolutionday 2016: Docker & FAAS at getvero.com
Cloudsolutionday 2016: Docker & FAAS at getvero.comCloudsolutionday 2016: Docker & FAAS at getvero.com
Cloudsolutionday 2016: Docker & FAAS at getvero.com
AWS Vietnam Community
 
.NET microservices with Azure Service Fabric
.NET microservices with Azure Service Fabric.NET microservices with Azure Service Fabric
.NET microservices with Azure Service Fabric
Davide Benvegnù
 
JavaEE Microservices platforms
JavaEE Microservices platformsJavaEE Microservices platforms
JavaEE Microservices platforms
Payara
 
Kubernetes as Orchestrator for A10 Lightning Controller
Kubernetes as Orchestrator for A10 Lightning ControllerKubernetes as Orchestrator for A10 Lightning Controller
Kubernetes as Orchestrator for A10 Lightning Controller
Akshay Mathur
 
Automation 2.0 - Automation Tools for Hybrid Cloud Environments
Automation 2.0 - Automation Tools for Hybrid Cloud EnvironmentsAutomation 2.0 - Automation Tools for Hybrid Cloud Environments
Automation 2.0 - Automation Tools for Hybrid Cloud Environments
Michael Rüefli
 
Secure JAX-RS
Secure JAX-RSSecure JAX-RS
Secure JAX-RS
Payara
 
Techniques for scaling application with security and visibility in cloud
Techniques for scaling application with security and visibility in cloudTechniques for scaling application with security and visibility in cloud
Techniques for scaling application with security and visibility in cloudAkshay Mathur
 
104 meets cloud
104 meets cloud104 meets cloud
104 meets cloud
Cliff Chao-kuan Lu
 

What's hot (20)

Tokyo azure meetup #12 service fabric internals
Tokyo azure meetup #12   service fabric internalsTokyo azure meetup #12   service fabric internals
Tokyo azure meetup #12 service fabric internals
 
Grails in the Cloud (2013)
Grails in the Cloud (2013)Grails in the Cloud (2013)
Grails in the Cloud (2013)
 
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
 
Data stores: beyond relational databases
Data stores: beyond relational databasesData stores: beyond relational databases
Data stores: beyond relational databases
 
Node and Micro-Services at IBM
Node and Micro-Services at IBMNode and Micro-Services at IBM
Node and Micro-Services at IBM
 
Who needs containers in a serverless world
Who needs containers in a serverless worldWho needs containers in a serverless world
Who needs containers in a serverless world
 
How Apache Kafka® Works
How Apache Kafka® WorksHow Apache Kafka® Works
How Apache Kafka® Works
 
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
 
How Class Data Sharing Can Speed up Your Jakarta EE Application Startup
How Class Data Sharing Can Speed up Your Jakarta EE Application StartupHow Class Data Sharing Can Speed up Your Jakarta EE Application Startup
How Class Data Sharing Can Speed up Your Jakarta EE Application Startup
 
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at UberWSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
 
Gradual migration to MicroProfile
Gradual migration to MicroProfileGradual migration to MicroProfile
Gradual migration to MicroProfile
 
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
 
Cloudsolutionday 2016: Docker & FAAS at getvero.com
Cloudsolutionday 2016: Docker & FAAS at getvero.comCloudsolutionday 2016: Docker & FAAS at getvero.com
Cloudsolutionday 2016: Docker & FAAS at getvero.com
 
.NET microservices with Azure Service Fabric
.NET microservices with Azure Service Fabric.NET microservices with Azure Service Fabric
.NET microservices with Azure Service Fabric
 
JavaEE Microservices platforms
JavaEE Microservices platformsJavaEE Microservices platforms
JavaEE Microservices platforms
 
Kubernetes as Orchestrator for A10 Lightning Controller
Kubernetes as Orchestrator for A10 Lightning ControllerKubernetes as Orchestrator for A10 Lightning Controller
Kubernetes as Orchestrator for A10 Lightning Controller
 
Automation 2.0 - Automation Tools for Hybrid Cloud Environments
Automation 2.0 - Automation Tools for Hybrid Cloud EnvironmentsAutomation 2.0 - Automation Tools for Hybrid Cloud Environments
Automation 2.0 - Automation Tools for Hybrid Cloud Environments
 
Secure JAX-RS
Secure JAX-RSSecure JAX-RS
Secure JAX-RS
 
Techniques for scaling application with security and visibility in cloud
Techniques for scaling application with security and visibility in cloudTechniques for scaling application with security and visibility in cloud
Techniques for scaling application with security and visibility in cloud
 
104 meets cloud
104 meets cloud104 meets cloud
104 meets cloud
 

Viewers also liked

MZ_Educational_Dev
MZ_Educational_DevMZ_Educational_Dev
MZ_Educational_DevMarco Zappa
 
Caracteristicas y mediaciones de la educacion a distancia
Caracteristicas y mediaciones de la educacion  a distanciaCaracteristicas y mediaciones de la educacion  a distancia
Caracteristicas y mediaciones de la educacion a distancia
Luis Angel Fuentes Uribe
 
Comment intégrer les switch Nebula à votre réseau
Comment intégrer les switch Nebula à votre réseauComment intégrer les switch Nebula à votre réseau
Comment intégrer les switch Nebula à votre réseau
Zyxel France
 
Highlight Portfolio_Xinyi Huang(April2016) (dragged)
Highlight Portfolio_Xinyi Huang(April2016) (dragged)Highlight Portfolio_Xinyi Huang(April2016) (dragged)
Highlight Portfolio_Xinyi Huang(April2016) (dragged)Xinyi Huang
 
Animales acuaticos
Animales acuaticosAnimales acuaticos
Redes sociales
Redes socialesRedes sociales
Redes sociales
Luis Angel Fuentes Uribe
 
Padilla sosa lizeth_margarita_tarea3
Padilla sosa lizeth_margarita_tarea3Padilla sosa lizeth_margarita_tarea3
Padilla sosa lizeth_margarita_tarea3
Lizeth Padilla
 
хакимкаиргельды+компания+клиенты
хакимкаиргельды+компания+клиентыхакимкаиргельды+компания+клиенты
хакимкаиргельды+компания+клиенты
Хаким Каиргельды
 
Near_Neighbours_Coventry_University_Evaluation (1)
Near_Neighbours_Coventry_University_Evaluation (1)Near_Neighbours_Coventry_University_Evaluation (1)
Near_Neighbours_Coventry_University_Evaluation (1)Tom Fisher
 
серкеноваулжан+ремонтквартир+клиенты
серкеноваулжан+ремонтквартир+клиентысеркеноваулжан+ремонтквартир+клиенты
серкеноваулжан+ремонтквартир+клиенты
Улжан Серкенова
 
Marketing
MarketingMarketing
Marketing
4 Mejores
 
Andre rieu
Andre rieuAndre rieu

Viewers also liked (13)

MZ_Educational_Dev
MZ_Educational_DevMZ_Educational_Dev
MZ_Educational_Dev
 
Caracteristicas y mediaciones de la educacion a distancia
Caracteristicas y mediaciones de la educacion  a distanciaCaracteristicas y mediaciones de la educacion  a distancia
Caracteristicas y mediaciones de la educacion a distancia
 
Comment intégrer les switch Nebula à votre réseau
Comment intégrer les switch Nebula à votre réseauComment intégrer les switch Nebula à votre réseau
Comment intégrer les switch Nebula à votre réseau
 
Highlight Portfolio_Xinyi Huang(April2016) (dragged)
Highlight Portfolio_Xinyi Huang(April2016) (dragged)Highlight Portfolio_Xinyi Huang(April2016) (dragged)
Highlight Portfolio_Xinyi Huang(April2016) (dragged)
 
Animales acuaticos
Animales acuaticosAnimales acuaticos
Animales acuaticos
 
Italy PowerPoint
Italy PowerPointItaly PowerPoint
Italy PowerPoint
 
Redes sociales
Redes socialesRedes sociales
Redes sociales
 
Padilla sosa lizeth_margarita_tarea3
Padilla sosa lizeth_margarita_tarea3Padilla sosa lizeth_margarita_tarea3
Padilla sosa lizeth_margarita_tarea3
 
хакимкаиргельды+компания+клиенты
хакимкаиргельды+компания+клиентыхакимкаиргельды+компания+клиенты
хакимкаиргельды+компания+клиенты
 
Near_Neighbours_Coventry_University_Evaluation (1)
Near_Neighbours_Coventry_University_Evaluation (1)Near_Neighbours_Coventry_University_Evaluation (1)
Near_Neighbours_Coventry_University_Evaluation (1)
 
серкеноваулжан+ремонтквартир+клиенты
серкеноваулжан+ремонтквартир+клиентысеркеноваулжан+ремонтквартир+клиенты
серкеноваулжан+ремонтквартир+клиенты
 
Marketing
MarketingMarketing
Marketing
 
Andre rieu
Andre rieuAndre rieu
Andre rieu
 

Similar to MVC 6 - the new unified Web programming model

SoCal Code Camp 2011 - ASP.NET MVC 4
SoCal Code Camp 2011 - ASP.NET MVC 4SoCal Code Camp 2011 - ASP.NET MVC 4
SoCal Code Camp 2011 - ASP.NET MVC 4Jon Galloway
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0
Ido Flatow
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
Thomas Robbins
 
Introduction to ASP.NET 5
Introduction to ASP.NET 5Introduction to ASP.NET 5
Introduction to ASP.NET 5
mbaric
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
Sirwan Afifi
 
ASP .Net Core SPA Templates
ASP .Net Core SPA TemplatesASP .Net Core SPA Templates
ASP .Net Core SPA Templates
Eamonn Boyle
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVCIntroduction to ASP.Net MVC
Introduction to ASP.Net MVCSagar Kamate
 
SOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class LibrariesSOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class Libraries
Vagif Abilov
 
ASP.NET 5 Overview - Post Build 2015
ASP.NET 5 Overview - Post Build 2015ASP.NET 5 Overview - Post Build 2015
ASP.NET 5 Overview - Post Build 2015
Shahed Chowdhuri
 
.NET Core: a new .NET Platform
.NET Core: a new .NET Platform.NET Core: a new .NET Platform
.NET Core: a new .NET Platform
Alex Thissen
 
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvpZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvpChalermpon Areepong
 
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
Tokyo Azure Meetup
 
Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC  Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC
vipin kumar
 
What's New in .Net 4.5
What's New in .Net 4.5What's New in .Net 4.5
What's New in .Net 4.5
Malam Team
 
ASP.NET
ASP.NETASP.NET
ASP.NET 5 Overview: Post RTM
ASP.NET 5 Overview: Post RTMASP.NET 5 Overview: Post RTM
ASP.NET 5 Overview: Post RTM
Shahed Chowdhuri
 
ASP.NET 5 Overview for Apex Systems
ASP.NET 5 Overview for Apex SystemsASP.NET 5 Overview for Apex Systems
ASP.NET 5 Overview for Apex Systems
Shahed Chowdhuri
 
Mvc4
Mvc4Mvc4
.NET Core Apps: Design & Development
.NET Core Apps: Design & Development.NET Core Apps: Design & Development
.NET Core Apps: Design & Development
GlobalLogic Ukraine
 

Similar to MVC 6 - the new unified Web programming model (20)

SoCal Code Camp 2011 - ASP.NET MVC 4
SoCal Code Camp 2011 - ASP.NET MVC 4SoCal Code Camp 2011 - ASP.NET MVC 4
SoCal Code Camp 2011 - ASP.NET MVC 4
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
 
Introduction to ASP.NET 5
Introduction to ASP.NET 5Introduction to ASP.NET 5
Introduction to ASP.NET 5
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
ASP .Net Core SPA Templates
ASP .Net Core SPA TemplatesASP .Net Core SPA Templates
ASP .Net Core SPA Templates
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVCIntroduction to ASP.Net MVC
Introduction to ASP.Net MVC
 
SOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class LibrariesSOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class Libraries
 
ASP.NET 5 Overview - Post Build 2015
ASP.NET 5 Overview - Post Build 2015ASP.NET 5 Overview - Post Build 2015
ASP.NET 5 Overview - Post Build 2015
 
.NET Core: a new .NET Platform
.NET Core: a new .NET Platform.NET Core: a new .NET Platform
.NET Core: a new .NET Platform
 
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvpZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
 
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
 
Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC  Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC
 
What's New in .Net 4.5
What's New in .Net 4.5What's New in .Net 4.5
What's New in .Net 4.5
 
ASP.NET
ASP.NETASP.NET
ASP.NET
 
ASP.NET 5 Overview: Post RTM
ASP.NET 5 Overview: Post RTMASP.NET 5 Overview: Post RTM
ASP.NET 5 Overview: Post RTM
 
ASP.NET 5 Overview for Apex Systems
ASP.NET 5 Overview for Apex SystemsASP.NET 5 Overview for Apex Systems
ASP.NET 5 Overview for Apex Systems
 
Mvc4
Mvc4Mvc4
Mvc4
 
.NET Core Apps: Design & Development
.NET Core Apps: Design & Development.NET Core Apps: Design & Development
.NET Core Apps: Design & Development
 
Mvc
MvcMvc
Mvc
 

More from Alex Thissen

Go (con)figure - Making sense of .NET configuration
Go (con)figure - Making sense of .NET configurationGo (con)figure - Making sense of .NET configuration
Go (con)figure - Making sense of .NET configuration
Alex Thissen
 
Logging, tracing and metrics: Instrumentation in .NET 5 and Azure
Logging, tracing and metrics: Instrumentation in .NET 5 and AzureLogging, tracing and metrics: Instrumentation in .NET 5 and Azure
Logging, tracing and metrics: Instrumentation in .NET 5 and Azure
Alex Thissen
 
Logging tracing and metrics in .NET Core and Azure - dotnetdays 2020
Logging tracing and metrics in .NET Core and Azure - dotnetdays 2020Logging tracing and metrics in .NET Core and Azure - dotnetdays 2020
Logging tracing and metrics in .NET Core and Azure - dotnetdays 2020
Alex Thissen
 
Health monitoring and dependency injection - CNUG November 2019
Health monitoring and dependency injection - CNUG November 2019Health monitoring and dependency injection - CNUG November 2019
Health monitoring and dependency injection - CNUG November 2019
Alex Thissen
 
Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019
Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019
Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019
Alex Thissen
 
I dont feel so well. Integrating health checks in your .NET Core solutions - ...
I dont feel so well. Integrating health checks in your .NET Core solutions - ...I dont feel so well. Integrating health checks in your .NET Core solutions - ...
I dont feel so well. Integrating health checks in your .NET Core solutions - ...
Alex Thissen
 
It depends: Loving .NET Core dependency injection or not
It depends: Loving .NET Core dependency injection or notIt depends: Loving .NET Core dependency injection or not
It depends: Loving .NET Core dependency injection or not
Alex Thissen
 
Overview of the new .NET Core and .NET Platform Standard
Overview of the new .NET Core and .NET Platform StandardOverview of the new .NET Core and .NET Platform Standard
Overview of the new .NET Core and .NET Platform Standard
Alex Thissen
 
How Docker and ASP.NET Core will change the life of a Microsoft developer
How Docker and ASP.NET Core will change the life of a Microsoft developerHow Docker and ASP.NET Core will change the life of a Microsoft developer
How Docker and ASP.NET Core will change the life of a Microsoft developer
Alex Thissen
 
Visual Studio Productivity tips
Visual Studio Productivity tipsVisual Studio Productivity tips
Visual Studio Productivity tips
Alex Thissen
 
Exploring microservices in a Microsoft landscape
Exploring microservices in a Microsoft landscapeExploring microservices in a Microsoft landscape
Exploring microservices in a Microsoft landscape
Alex Thissen
 
Asynchronous programming in ASP.NET
Asynchronous programming in ASP.NETAsynchronous programming in ASP.NET
Asynchronous programming in ASP.NET
Alex Thissen
 
Visual Studio 2015 experts tips and tricks
Visual Studio 2015 experts tips and tricksVisual Studio 2015 experts tips and tricks
Visual Studio 2015 experts tips and tricks
Alex Thissen
 
ASP.NET 5 - Microsoft's Web development platform reimagined
ASP.NET 5 - Microsoft's Web development platform reimaginedASP.NET 5 - Microsoft's Web development platform reimagined
ASP.NET 5 - Microsoft's Web development platform reimagined
Alex Thissen
 
//customer/
//customer///customer/
//customer/
Alex Thissen
 

More from Alex Thissen (15)

Go (con)figure - Making sense of .NET configuration
Go (con)figure - Making sense of .NET configurationGo (con)figure - Making sense of .NET configuration
Go (con)figure - Making sense of .NET configuration
 
Logging, tracing and metrics: Instrumentation in .NET 5 and Azure
Logging, tracing and metrics: Instrumentation in .NET 5 and AzureLogging, tracing and metrics: Instrumentation in .NET 5 and Azure
Logging, tracing and metrics: Instrumentation in .NET 5 and Azure
 
Logging tracing and metrics in .NET Core and Azure - dotnetdays 2020
Logging tracing and metrics in .NET Core and Azure - dotnetdays 2020Logging tracing and metrics in .NET Core and Azure - dotnetdays 2020
Logging tracing and metrics in .NET Core and Azure - dotnetdays 2020
 
Health monitoring and dependency injection - CNUG November 2019
Health monitoring and dependency injection - CNUG November 2019Health monitoring and dependency injection - CNUG November 2019
Health monitoring and dependency injection - CNUG November 2019
 
Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019
Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019
Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019
 
I dont feel so well. Integrating health checks in your .NET Core solutions - ...
I dont feel so well. Integrating health checks in your .NET Core solutions - ...I dont feel so well. Integrating health checks in your .NET Core solutions - ...
I dont feel so well. Integrating health checks in your .NET Core solutions - ...
 
It depends: Loving .NET Core dependency injection or not
It depends: Loving .NET Core dependency injection or notIt depends: Loving .NET Core dependency injection or not
It depends: Loving .NET Core dependency injection or not
 
Overview of the new .NET Core and .NET Platform Standard
Overview of the new .NET Core and .NET Platform StandardOverview of the new .NET Core and .NET Platform Standard
Overview of the new .NET Core and .NET Platform Standard
 
How Docker and ASP.NET Core will change the life of a Microsoft developer
How Docker and ASP.NET Core will change the life of a Microsoft developerHow Docker and ASP.NET Core will change the life of a Microsoft developer
How Docker and ASP.NET Core will change the life of a Microsoft developer
 
Visual Studio Productivity tips
Visual Studio Productivity tipsVisual Studio Productivity tips
Visual Studio Productivity tips
 
Exploring microservices in a Microsoft landscape
Exploring microservices in a Microsoft landscapeExploring microservices in a Microsoft landscape
Exploring microservices in a Microsoft landscape
 
Asynchronous programming in ASP.NET
Asynchronous programming in ASP.NETAsynchronous programming in ASP.NET
Asynchronous programming in ASP.NET
 
Visual Studio 2015 experts tips and tricks
Visual Studio 2015 experts tips and tricksVisual Studio 2015 experts tips and tricks
Visual Studio 2015 experts tips and tricks
 
ASP.NET 5 - Microsoft's Web development platform reimagined
ASP.NET 5 - Microsoft's Web development platform reimaginedASP.NET 5 - Microsoft's Web development platform reimagined
ASP.NET 5 - Microsoft's Web development platform reimagined
 
//customer/
//customer///customer/
//customer/
 

Recently uploaded

Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 

Recently uploaded (20)

Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 

MVC 6 - the new unified Web programming model

  • 1.
  • 2. Alex Thissen Lead Consultant Xpirit ASP.NET MVC 6 A new unified programming model for the web
  • 3. Agenda • Short overview ASP.NET 5 • A unified programming model • Controllers • Dependency Injection • Routing • Summary • Questions and Answers
  • 6. Characteristics of MVC 6 •One set of concepts – remove duplication •Web UI and APIs combined •Smooth transition from Web Pages to MVC Unified •Run on IIS or self-host or cross-platform •Based on new request pipeline in ASP.NET 5 •Runs in cloud-optimized Core CLR Built on top of ASP.NET 5 •Pay as you use •Middleware •Built with Dependency Injection first Modular Getting familiar
  • 7. .NET Framework vNext Full .NET CLR • Entire API set in machine wide install at 200 MB • Updated with OS • Ecosystem of existing packages • Backward compatibility • Default for Visual Studio 2015 projects Cloud Optimized CLR • Lean and modular runtime • Optimized for server • Small memory footprint • Libraries in NuGet packages • Framework deployed with app • Different versions can run side-by-side • 11 MB Mono • Cross-Platform runtime for Linux and Mac OS X • Together with Mono community Standing on the shoulders of a new giant ASP.NET 5.0 ASP.NET 5.0 ASP.NET 5.0
  • 8. Getting started • Middleware model introduced by OWIN Ready, set, start – a lap around MVC 6
  • 9. Middleware conceptually • Middleware stack • Static files • Security, authentication, CORS • Diagnostics, logging • Other cross-cutting concerns Host process and server Application and framework RequestDelegate delegate Task RequestDelegate(HttpContext context);
  • 10. public void Configure(IApplicationBuilder app) { app.Map("/Nancy", builder => { builder.UseRuntimeInfo(); builder.RunNancyFx(); }); app.UseCors(); app.UseMvc(cfg); Use, Map and Run app.UseErrorPage(); Application FX Middleware
  • 11. Controllers • Single base class for MVC and Web API • Not required • POCO Controllers • No base class • Combine Web API and MVC in 1 class • UI and REST endpoints at one base URI Not your typical gaming gear
  • 13. Dependency Injection • DI is core part of runtime • Built-in DI for configuration and services – Default lightweight version available • Wire up your own favorite IoC container ... – Autofac, Ninject, StructureMap, Unity, Castle Windsor public void ConfigureServices(IServiceCollection services) { // Add EF services to the services container. services.AddEntityFramework(Configuration) .AddSqlServer() .AddDbContext<ApplicationDbContext>();
  • 14. Built-in DI Container • Register mappings in ConfigureServices of Startup • Default registrations • Lifetimes – Transient – Scoped – Singleton – Instance • Rules for registering mapping – First one wins – Allows you to get ahead off default mappings Sometimes better is worse than good enough
  • 15. Activation Activation method Example Constructor on classes MyController(ILog logger) Attribute on field or property [Activate] ILog Logger { get;set; } Attribute in action [FromServices] ILog logger Directive in Razor page ILog logger Inject those objects @inject
  • 16. Tag Helpers • Allow server-side code to participate in rendering of HTML elements in Razor files • Target HTML elements based on element and attribute names • Reduce explicit transitions between HTML and C# • Take advantage of composition and tooling benefits in Visual Studio Code and 2015 Getting some help in Razor
  • 17. Custom Tag Helpers namespace TechDays.TagHelpers { [TargetElement("datumtijd")] public class DateTimeTagHelper : TagHelper { public override void Process(TagHelperContext context, TagHelperOutput output) { output.Content.SetContent(DateTime.Now.ToString()); } } } // Inside Razor .cshtml file @addTagHelper "*, TechDays.TagHelpers"
  • 18. Routing • Familiar MVC 5 attribute based routing • Enabled by default • Special tokens: [controller] and [action] Show me the way [Route("api/Hello")] public class HelloController : Controller { [Route] public string Get() { return "hello"; } } [Route("api/[controller]")] public class HelloController : Controller { [Route] public string Get() { return "hello"; } }
  • 19. View components • Comparable to Web Forms’ UserControls • Different from Partial Views • Combines code and view as logical unit User controls in MVC style
  • 20. Logging • Pluggable logging infrastructure provided • ILoggerFactory • Logging levels – from Debug up to Criticial
  • 21. Summary • Unified programming model • Built on ASP.NET 5 • Learn Dependency Injection • Command-line vs. Visual Studio Key takeaways from ASP.NET MVC 6
  • 22. Your feedback is important! Scan the QR Code and let us know via the TechDays App. Laat ons weten wat u van de sessie vindt! Scan the QR Code via de TechDays App. Bent u al lid van de Microsot Virtual Academy?! Op MVA kunt u altijd iets nieuws leren over de laatste technologie van Microsoft. Meld u vandaag aan op de MVA Stand. MVA biedt 7/24 gratis online training on-demand voor IT- Professionals en Ontwikkelaars.

Editor's Notes

  1. diego_cervo/istockphoto.com