SlideShare a Scribd company logo
1 of 19
Download to read offline
1
ASP.NET Core 1 (formerly ASP.NET 5)
What has changed for MVC and Web API devs?
Manfred Steyer
ManfredSteyer
About me …
 Manfred Steyer
 SOFTWAREarchitekt.at
 Trainer & Consultant
 Angular
 Server-Side .NET
Page  2
2
Goal
Overview of changes for
MVC- and Web API-Devs regarding
ASP.NET Core
Folie 3
Didactics
Slides
Samples
Folie 9
3
Contents
Overview of ASP.NET Core 1
Bootstrapping
Web Apps
Web APIs
Folie 11
OVERVIEW OF ASP.NET CORE
Page  22
4
.NET Core
Folie 24
[http://www.hanselman.com/]
Advantages
Folie 25
X-Plattform Lightweight NuGet
Side-by-
Side
Self-Hosting
F5-Compile-
to-Memory
5
Hosting
Kestrel (X-Plattform, Self-Host)
WebListener (Windows, Self-Host)
IIS  Kestrel
Nginx  Kestrel
Folie 26
Why a new ASP.NET?
Folie 27
ASP.NET Frameworks
System.Web
IIS
6
System.Web
Features of System.Web have to be
reimplemented
Sessions, Caching, Configuration, Routing
Consequence: Breaking-Changes
Folie 30
Doublings today
Web API MVC Web Pages
7
ASP.NET MVC Core 1
Unification of MVC, Web API
and (in future) Web Pages
Uniform concepts for Controllers, Views,
Dependency-Injection, Routing, Filters etc.
Migration
Code needs adaptation
But: Current framework-versions will be maintained
Saying that: WCF and Web Forms wont't be
migrated to Core
WCF Web Forms Web API 2MVC 5
.NET 4.x / "Full CLR"
8
ASP.NET CORE 1:
BOOTSTRAPPING
Page  34
Middleware-Components
Folie 35
Server
Web-Framework
Web-Application
Middleware1
Middleware2
Middleware…
Middlewaren
Request
Response
Host-Process
HTTP
9
Configuring the Pipeline
Folie 36
public class Startup
{
[…]
public void Configure(IApplicationBuilder app)
{
[…]
app.UseStaticFiles();
app.UseMvc();
[…]
}
}
Configuration considering the Environment
Folie 37
public void Configure(IApplicationBuilder app,
IHostingEnvironment env)
{
[…]
if (env.IsDevelopment()) {
app.UseDeveloperExceptionPage();
}
else {
app.UseExceptionHandler("/Home/Error");
}
[…]
}
10
Configuring Services
Folie 38
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
[…]
services.AddMvc()
[…]
}
[…]
}
DEMO
Page  40
11
TAG-HELPER
Page  45
@model IEnumerable<MvcApplication.Models.Flight>
[…]
@foreach (var item in Model) {
<tr>
<td>
@item.Von
</td>
<td>
@item.Nach
</td>
<td>
@Html.ActionLink(
"Edit", "Edit",
"Home", new { id = "1" }, null)
</td>
</tr>
}
HtmlHelpers in ASP.NET MVC 5
12
@model IEnumerable<MvcApplication.Models.Flight>
[…]
@foreach (var item in Model) {
<tr>
<td>
@item.Von
</td>
<td>
@item.Nach
</td>
<td>
<a asp-controller="Home"
asp-action="Edit"
asp-route-id="1" class="navbar-brand">Edit</a>
</td>
</tr>
}
Tag-Helpers
Using TagHelpers
 @addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"
Global: Views/_ViewImports.cshtml
Folie 48
13
WEB APIS WITH MVC CORE 1
Page  50
Web APIs in MVC Core 1
No own Routing for Web APIs
Same concept as for MVC
No Conventions for HTTP Verb,
like GetAll()  GET, PostData()  POST
Routing doesn't consider URL-Parameters to select
an action-method
But: WebApiCompatShim
Folie 51
14
Web API with Attribute-based Routes
Folie 52
[Route("api/[controller]")]
public class FlightController: Controller
{
[HttpGet("{id}")]
public Flight GetById(int id) { […] }
[HttpGet("byRoute")]
public List<Flight> GetByRoute(string from, string to) { […] }
[HttpPost]
public void PostFlight([FromBody] Flight flight) { […] }
}
Web API with Attribute-based Routes
Folie 53
[Route("api/[controller]")]
public class FlightController: Controller
{
// GET api/flight/{id}
[HttpGet("{id}")]
public Flight GetById(int id) { […] }
[HttpGet("byRoute")]
public List<Flight> GetByRoute(string from, string to) { […] }
[HttpPost]
public void PostFlight([FromBody] Flight flight) { […] }
}
15
Web API with Attribute-based Routes
Folie 54
[Route("api/[controller]")]
public class FlightController: Controller
{
// GET api/flight/{id}
[HttpGet("{id}")]
public Flight GetById(int id) { […] }
// GET api/flight/byRoute?from=...&to=...
[HttpGet("byRoute")]
public List<Flight> GetByRoute(string from, string to) { […] }
[HttpPost]
public void PostFlight([FromBody] Flight flight) { […] }
}
Web API with Attribute-based Routes
Folie 55
[Route("api/[controller]")]
public class FlightController: Controller
{
// GET api/flight/{id}
[HttpGet("{id}")]
public Flight GetById(int id) { […] }
// GET api/flight/byRoute?from=...&to=...
[HttpGet("byRoute")]
public List<Flight> GetByRoute(string from, string to) { […] }
// POST api/flight
[HttpPost]
public void PostFlight([FromBody] Flight flight) { […] }
}
16
DEMO
Page  56
Configuring MVC and Formatters
Folie 57
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc()
.AddJsonOptions(options => { […] })
.AddMvcOptions(options => { […] });
}
[…]
}
17
XML-Formatter
Package:
Microsoft.AspNetCore.Mvc.Formatters.Xml
 XmlDataContractSerializerInputFormatter
 XmlDataContractSerializerOutputFormatter
Folie 58
DEMO
Page  59
18
Summary
Folie 80
X-Plattform F5-Compile Side-by-Side
Self-Hosting
DI, DI
everywhere…
Tag Helpers
Summary
Folie 81
Unification
of MVC and
Web API
High-Level-
APIs quite
the same
MVC-Style
Routing
Low-Level
APIs
reworked
Current
versions still
maintained
19
manfred.steyer@SOFTWAREarchitekt.at
SOFTWAREarchitekt.at
ManfredSteyer
Contact

More Related Content

What's hot

Andy Bosch - JavaServer Faces in the cloud
Andy Bosch -  JavaServer Faces in the cloudAndy Bosch -  JavaServer Faces in the cloud
Andy Bosch - JavaServer Faces in the cloud
Andy Bosch
 
Declarative Services - Dependency Injection OSGi Style
Declarative Services - Dependency Injection OSGi StyleDeclarative Services - Dependency Injection OSGi Style
Declarative Services - Dependency Injection OSGi Style
Felix Meschberger
 

What's hot (20)

Introduction to lightning Web Component
Introduction to lightning Web ComponentIntroduction to lightning Web Component
Introduction to lightning Web Component
 
Sails.js Intro
Sails.js IntroSails.js Intro
Sails.js Intro
 
ASP.NET Core 2.1: The Future of Web Apps
ASP.NET Core 2.1: The Future of Web AppsASP.NET Core 2.1: The Future of Web Apps
ASP.NET Core 2.1: The Future of Web Apps
 
Andy Bosch - JavaServer Faces in the cloud
Andy Bosch -  JavaServer Faces in the cloudAndy Bosch -  JavaServer Faces in the cloud
Andy Bosch - JavaServer Faces in the cloud
 
The future of web development write once, run everywhere with angular js an...
The future of web development   write once, run everywhere with angular js an...The future of web development   write once, run everywhere with angular js an...
The future of web development write once, run everywhere with angular js an...
 
Introduction to Lightning Web Component
Introduction to Lightning Web Component Introduction to Lightning Web Component
Introduction to Lightning Web Component
 
Lightning web component
Lightning web componentLightning web component
Lightning web component
 
ASP.NET Core 2.1: The Future of Web Apps
ASP.NET Core 2.1: The Future of Web AppsASP.NET Core 2.1: The Future of Web Apps
ASP.NET Core 2.1: The Future of Web Apps
 
Rails Engine :: modularize you app
Rails Engine :: modularize you appRails Engine :: modularize you app
Rails Engine :: modularize you app
 
Declarative Services - Dependency Injection OSGi Style
Declarative Services - Dependency Injection OSGi StyleDeclarative Services - Dependency Injection OSGi Style
Declarative Services - Dependency Injection OSGi Style
 
02 configuration
02   configuration02   configuration
02 configuration
 
Asp.net core 1.0 (Peter Himschoot)
Asp.net core 1.0 (Peter Himschoot)Asp.net core 1.0 (Peter Himschoot)
Asp.net core 1.0 (Peter Himschoot)
 
DEV208 - ASP.NET MVC 5 新功能探索
DEV208 - ASP.NET MVC 5 新功能探索DEV208 - ASP.NET MVC 5 新功能探索
DEV208 - ASP.NET MVC 5 新功能探索
 
Spring Boot Update
Spring Boot UpdateSpring Boot Update
Spring Boot Update
 
Rails Engine | Modular application
Rails Engine | Modular applicationRails Engine | Modular application
Rails Engine | Modular application
 
All things open 2019 crazy-sm-ecosystem
All things open 2019 crazy-sm-ecosystemAll things open 2019 crazy-sm-ecosystem
All things open 2019 crazy-sm-ecosystem
 
Selenium drivers
Selenium driversSelenium drivers
Selenium drivers
 
Tamir Dresher - What’s new in ASP.NET Core 6
Tamir Dresher - What’s new in ASP.NET Core 6Tamir Dresher - What’s new in ASP.NET Core 6
Tamir Dresher - What’s new in ASP.NET Core 6
 
All Things Open 2019 weave-services-istio
All Things Open 2019 weave-services-istioAll Things Open 2019 weave-services-istio
All Things Open 2019 weave-services-istio
 
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)
 

Similar to ASP.NET Core 1 for MVC- and WebAPI-Devs

Aspnet architecture
Aspnet architectureAspnet architecture
Aspnet architecture
phantrithuc
 
ASPNet MVC series for beginers part 1
ASPNet MVC series for beginers part 1ASPNet MVC series for beginers part 1
ASPNet MVC series for beginers part 1
Gaurav Arora
 

Similar to ASP.NET Core 1 for MVC- and WebAPI-Devs (20)

Aspnet architecture
Aspnet architectureAspnet architecture
Aspnet architecture
 
Supporting and Using EC2/CIMI on top of Cloud Environments via Deltacloud
Supporting and Using EC2/CIMI on top of Cloud Environments via DeltacloudSupporting and Using EC2/CIMI on top of Cloud Environments via Deltacloud
Supporting and Using EC2/CIMI on top of Cloud Environments via Deltacloud
 
Sprint Portlet MVC Seminar
Sprint Portlet MVC SeminarSprint Portlet MVC Seminar
Sprint Portlet MVC Seminar
 
Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0
 
MVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming modelMVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming model
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVC
 
Asp dot net long
Asp dot net longAsp dot net long
Asp dot net long
 
Microsoft Tech Ed 2006 #1
Microsoft Tech Ed 2006 #1Microsoft Tech Ed 2006 #1
Microsoft Tech Ed 2006 #1
 
Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVC
 
ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
Quick Fetch API Introduction
Quick Fetch API IntroductionQuick Fetch API Introduction
Quick Fetch API Introduction
 
ASP.NET - Introduction to Web Forms and MVC
ASP.NET - Introduction to Web Forms and MVCASP.NET - Introduction to Web Forms and MVC
ASP.NET - Introduction to Web Forms and MVC
 
Building Restful Web App Rapidly in CakePHP
Building Restful Web App Rapidly in CakePHPBuilding Restful Web App Rapidly in CakePHP
Building Restful Web App Rapidly in CakePHP
 
ASP.NET Core 1.0 Overview
ASP.NET Core 1.0 OverviewASP.NET Core 1.0 Overview
ASP.NET Core 1.0 Overview
 
Rapid Development With CakePHP
Rapid Development With CakePHPRapid Development With CakePHP
Rapid Development With CakePHP
 
Integrate any Angular Project into WebSphere Portal
Integrate any Angular Project into WebSphere PortalIntegrate any Angular Project into WebSphere Portal
Integrate any Angular Project into WebSphere Portal
 
Using HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in JavaUsing HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in Java
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
 
ASPNet MVC series for beginers part 1
ASPNet MVC series for beginers part 1ASPNet MVC series for beginers part 1
ASPNet MVC series for beginers part 1
 

More from Manfred Steyer

More from Manfred Steyer (20)

Der neue Component Router für Angular 2
Der neue Component Router für Angular 2Der neue Component Router für Angular 2
Der neue Component Router für Angular 2
 
Datenbindung und Performance in Angular 2
Datenbindung und Performance in Angular 2Datenbindung und Performance in Angular 2
Datenbindung und Performance in Angular 2
 
Single Page Applications neu gedacht: Redux in Angular 2 mit @ngrx/store
Single Page Applications neu gedacht: Redux in Angular 2 mit @ngrx/storeSingle Page Applications neu gedacht: Redux in Angular 2 mit @ngrx/store
Single Page Applications neu gedacht: Redux in Angular 2 mit @ngrx/store
 
Offlinefähige Browseranwendungen: Progressive Web-Apps mit Angular 2
Offlinefähige Browseranwendungen: Progressive Web-Apps mit Angular 2Offlinefähige Browseranwendungen: Progressive Web-Apps mit Angular 2
Offlinefähige Browseranwendungen: Progressive Web-Apps mit Angular 2
 
Angular 2: Die Ideen hinter Datenbindung und Formularen im Detail betrachtet
Angular 2: Die Ideen hinter Datenbindung und Formularen im Detail betrachtetAngular 2: Die Ideen hinter Datenbindung und Formularen im Detail betrachtet
Angular 2: Die Ideen hinter Datenbindung und Formularen im Detail betrachtet
 
Datengetriebene Web APIs mit Entity Framework
Datengetriebene Web APIs mit Entity FrameworkDatengetriebene Web APIs mit Entity Framework
Datengetriebene Web APIs mit Entity Framework
 
Angular 2 Upgrade: Migration von AngularJS 1.x zu 2.0
Angular 2 Upgrade: Migration von AngularJS 1.x zu 2.0Angular 2 Upgrade: Migration von AngularJS 1.x zu 2.0
Angular 2 Upgrade: Migration von AngularJS 1.x zu 2.0
 
Web APIs mit ASP.NET Core 1
Web APIs mit ASP.NET Core 1Web APIs mit ASP.NET Core 1
Web APIs mit ASP.NET Core 1
 
The newst new Router for Angular 2 ("Version 3")
The newst new Router for Angular 2 ("Version 3")The newst new Router for Angular 2 ("Version 3")
The newst new Router for Angular 2 ("Version 3")
 
Databinding and Performance-Tuning in Angular 2
Databinding and Performance-Tuning in Angular 2Databinding and Performance-Tuning in Angular 2
Databinding and Performance-Tuning in Angular 2
 
Modern authentication solutions in Angular 2 with OAuth 2.0 and OpenId Connect
Modern authentication solutions in Angular 2 with OAuth 2.0 and OpenId ConnectModern authentication solutions in Angular 2 with OAuth 2.0 and OpenId Connect
Modern authentication solutions in Angular 2 with OAuth 2.0 and OpenId Connect
 
Progressive web apps with Angular 2
Progressive web apps with Angular 2Progressive web apps with Angular 2
Progressive web apps with Angular 2
 
Der neueste neue Router (Version 3) für Angular 2
Der neueste neue Router (Version 3) für Angular 2Der neueste neue Router (Version 3) für Angular 2
Der neueste neue Router (Version 3) für Angular 2
 
Webpack
WebpackWebpack
Webpack
 
EF Core 1: News features and changes
EF Core 1: News features and changesEF Core 1: News features and changes
EF Core 1: News features and changes
 
Angular 2: Migration - SSD 2016 London
Angular 2: Migration - SSD 2016 LondonAngular 2: Migration - SSD 2016 London
Angular 2: Migration - SSD 2016 London
 
Angular 2 - SSD 2016 London
Angular 2 - SSD 2016 LondonAngular 2 - SSD 2016 London
Angular 2 - SSD 2016 London
 
ASP.NET Web API Deep Dive - SSD 2016 London
ASP.NET Web API Deep Dive - SSD 2016 LondonASP.NET Web API Deep Dive - SSD 2016 London
ASP.NET Web API Deep Dive - SSD 2016 London
 
Was bringt Angular 2?
Was bringt Angular 2?Was bringt Angular 2?
Was bringt Angular 2?
 
Web APIs mit ASP.NET MVC Core 1
Web APIs mit ASP.NET MVC Core 1Web APIs mit ASP.NET MVC Core 1
Web APIs mit ASP.NET MVC Core 1
 

Recently uploaded

6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
imonikaupta
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
nilamkumrai
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 

Recently uploaded (20)

Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 

ASP.NET Core 1 for MVC- and WebAPI-Devs

  • 1. 1 ASP.NET Core 1 (formerly ASP.NET 5) What has changed for MVC and Web API devs? Manfred Steyer ManfredSteyer About me …  Manfred Steyer  SOFTWAREarchitekt.at  Trainer & Consultant  Angular  Server-Side .NET Page  2
  • 2. 2 Goal Overview of changes for MVC- and Web API-Devs regarding ASP.NET Core Folie 3 Didactics Slides Samples Folie 9
  • 3. 3 Contents Overview of ASP.NET Core 1 Bootstrapping Web Apps Web APIs Folie 11 OVERVIEW OF ASP.NET CORE Page  22
  • 4. 4 .NET Core Folie 24 [http://www.hanselman.com/] Advantages Folie 25 X-Plattform Lightweight NuGet Side-by- Side Self-Hosting F5-Compile- to-Memory
  • 5. 5 Hosting Kestrel (X-Plattform, Self-Host) WebListener (Windows, Self-Host) IIS  Kestrel Nginx  Kestrel Folie 26 Why a new ASP.NET? Folie 27 ASP.NET Frameworks System.Web IIS
  • 6. 6 System.Web Features of System.Web have to be reimplemented Sessions, Caching, Configuration, Routing Consequence: Breaking-Changes Folie 30 Doublings today Web API MVC Web Pages
  • 7. 7 ASP.NET MVC Core 1 Unification of MVC, Web API and (in future) Web Pages Uniform concepts for Controllers, Views, Dependency-Injection, Routing, Filters etc. Migration Code needs adaptation But: Current framework-versions will be maintained Saying that: WCF and Web Forms wont't be migrated to Core WCF Web Forms Web API 2MVC 5 .NET 4.x / "Full CLR"
  • 8. 8 ASP.NET CORE 1: BOOTSTRAPPING Page  34 Middleware-Components Folie 35 Server Web-Framework Web-Application Middleware1 Middleware2 Middleware… Middlewaren Request Response Host-Process HTTP
  • 9. 9 Configuring the Pipeline Folie 36 public class Startup { […] public void Configure(IApplicationBuilder app) { […] app.UseStaticFiles(); app.UseMvc(); […] } } Configuration considering the Environment Folie 37 public void Configure(IApplicationBuilder app, IHostingEnvironment env) { […] if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } […] }
  • 10. 10 Configuring Services Folie 38 public class Startup { public void ConfigureServices(IServiceCollection services) { […] services.AddMvc() […] } […] } DEMO Page  40
  • 11. 11 TAG-HELPER Page  45 @model IEnumerable<MvcApplication.Models.Flight> […] @foreach (var item in Model) { <tr> <td> @item.Von </td> <td> @item.Nach </td> <td> @Html.ActionLink( "Edit", "Edit", "Home", new { id = "1" }, null) </td> </tr> } HtmlHelpers in ASP.NET MVC 5
  • 12. 12 @model IEnumerable<MvcApplication.Models.Flight> […] @foreach (var item in Model) { <tr> <td> @item.Von </td> <td> @item.Nach </td> <td> <a asp-controller="Home" asp-action="Edit" asp-route-id="1" class="navbar-brand">Edit</a> </td> </tr> } Tag-Helpers Using TagHelpers  @addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers" Global: Views/_ViewImports.cshtml Folie 48
  • 13. 13 WEB APIS WITH MVC CORE 1 Page  50 Web APIs in MVC Core 1 No own Routing for Web APIs Same concept as for MVC No Conventions for HTTP Verb, like GetAll()  GET, PostData()  POST Routing doesn't consider URL-Parameters to select an action-method But: WebApiCompatShim Folie 51
  • 14. 14 Web API with Attribute-based Routes Folie 52 [Route("api/[controller]")] public class FlightController: Controller { [HttpGet("{id}")] public Flight GetById(int id) { […] } [HttpGet("byRoute")] public List<Flight> GetByRoute(string from, string to) { […] } [HttpPost] public void PostFlight([FromBody] Flight flight) { […] } } Web API with Attribute-based Routes Folie 53 [Route("api/[controller]")] public class FlightController: Controller { // GET api/flight/{id} [HttpGet("{id}")] public Flight GetById(int id) { […] } [HttpGet("byRoute")] public List<Flight> GetByRoute(string from, string to) { […] } [HttpPost] public void PostFlight([FromBody] Flight flight) { […] } }
  • 15. 15 Web API with Attribute-based Routes Folie 54 [Route("api/[controller]")] public class FlightController: Controller { // GET api/flight/{id} [HttpGet("{id}")] public Flight GetById(int id) { […] } // GET api/flight/byRoute?from=...&to=... [HttpGet("byRoute")] public List<Flight> GetByRoute(string from, string to) { […] } [HttpPost] public void PostFlight([FromBody] Flight flight) { […] } } Web API with Attribute-based Routes Folie 55 [Route("api/[controller]")] public class FlightController: Controller { // GET api/flight/{id} [HttpGet("{id}")] public Flight GetById(int id) { […] } // GET api/flight/byRoute?from=...&to=... [HttpGet("byRoute")] public List<Flight> GetByRoute(string from, string to) { […] } // POST api/flight [HttpPost] public void PostFlight([FromBody] Flight flight) { […] } }
  • 16. 16 DEMO Page  56 Configuring MVC and Formatters Folie 57 public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddMvc() .AddJsonOptions(options => { […] }) .AddMvcOptions(options => { […] }); } […] }
  • 18. 18 Summary Folie 80 X-Plattform F5-Compile Side-by-Side Self-Hosting DI, DI everywhere… Tag Helpers Summary Folie 81 Unification of MVC and Web API High-Level- APIs quite the same MVC-Style Routing Low-Level APIs reworked Current versions still maintained