SlideShare a Scribd company logo
ASP.NET Core 1.0 Deep Dive
Peter Himschoot
About me
• Peter Himschoot
• Trainer for U2U
• .NET
• Web
• iOS
• Microsoft Regional Director for BeLux
• Independent developer evangelist
Agenda
• We’re going to talk about extensibility
• Middleware
• Tag Helpers
• Customization
• …
ASP.NET Core
Pipeline
Building your own middleware
ASP.NET Core Pipeline
ResponseRequest Middleware
Existing Middleware
• Static files
• Routing
• Error Handling
• MVC
app.UseExceptionHandler("/Home/Error");
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
app.UseRouter(routes);
Your own middleware
• Build class implementing
• Use extension method to install it
Task Invoke(HttpContext context)
public static IApplicationBuilder UsePrimeChecker(
this IApplicationBuilder builder, PrimeCheckerOptions options)
=> builder.Use(next => new Middleware(next, options).Invoke);
}
Unit Testing
Integration Testing
Unit Testing
• Fully supported in .NET Core 1.0
• Need to add the test runner as a command
"dependencies": {
"xunit": "2.1.0",
"xunit.runner.dnx": "2.1.0-rc1-build204",
"Microsoft.AspNet.TestHost": "1.0.0-rc1-final",
"IsPrime": "1.0.0-*"
},
"commands": {
"test": "xunit.runner.dnx"
}
Integration Testing
• ASP.NET Core 1.0 supports testing website without host
// Arrange
var server = new TestServer(TestServer.CreateBuilder().UseStartup<Startup>());
var client = server.CreateClient();
// Act
string request = "/checkprime?5";
var response = await client.GetAsync(request);
response.EnsureSuccessStatusCode();
var responseString = await response.Content.ReadAsStringAsync();
// Assert
Assert.Equal("5 is prime!", responseString);
MVC6
Tag Helpers
Building your own tag helper
Taghelpers
• Enable us to write nicer razor code
• Look a lot like angular.js and knockout.js
• Example:
<ul class="nav navbar-nav">
<li><a asp-controller="Home" asp-action="Index">Home</a></li>
<li><a asp-controller="Home" asp-action="About">About</a></li>
<li><a asp-controller="Home" asp-action="Contact">Contact</a></li>
</ul>
HtmlHelper vs. Tag helper
• Is there any doubt?
@Html.EditorFor(model => model.Title,
htmlAttributes: new { @class = "form-control"})
<input asp-for="Title" type="text" class="form-control" />
Building a custom tag helper
<ul u2u-property="Address.City" u2u-items="Model"></ul>
Tweaking
Adding nameof() support in Views
Using C#6 nameof instead of strings
• Again?!
• I want this!
• But it is not supported…
• I want this!
• So let’s add it…
<a asp-controller="@nameof(HomeController)"
asp-action="@nameof(HomeController.Index)">Home</a>
<a asp-controller="Home" asp-action="Index">Home</a>
Use the Source Luke!
• Debugging with MVC Sources
• Simply add path to sources in global.json
{
"projects": [ "src", "test", "C://Mvc//src" ],
"sdk": {
"version": "1.0.0-rc1-final"
}
}
NuGet projects
Building your own NuGet Package
New Visual Studio projects make this easy!
• Using dnu pack command
VISUG Partners

More Related Content

PPTX
Building your first android app using xamarin (Gill Cleeren)
PPTX
Introduction to ASP.NET 5
PPTX
ASP.NET 5 Overview
PPT
TDD with ASP.NET MVC 1.0
PPT
Introduction to ASP.NET MVC 1.0
PDF
Embracing HTTP in the era of API’s
PPTX
Angular on ASP.NET MVC 6
PPTX
Debugging your Way through .NET with Visual Studio 2015
Building your first android app using xamarin (Gill Cleeren)
Introduction to ASP.NET 5
ASP.NET 5 Overview
TDD with ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0
Embracing HTTP in the era of API’s
Angular on ASP.NET MVC 6
Debugging your Way through .NET with Visual Studio 2015

What's hot (20)

PPTX
A Gentle Introduction to Blazor
PPTX
Evolution / History of ASP.NET
PPTX
Learning ASP.NET 5 and MVC 6
PDF
Introduction to ASP.NET MVC
PPTX
Azure Serverless Conf
PPTX
Codegen2021 blazor mobile
PDF
Introduction to Selenium Webdriver - SpringPeople
PPTX
Modern Applications With Asp.net Core 5 and Vue JS 3
PPTX
ASP.NET Core 1.0
PPTX
Discuss About ASP.NET MVC 6 and ASP.NET MVC 5
PPTX
ASP.NET Core 2.1: The Future of Web Apps
PPTX
Building real time app by using asp.Net Core
PPTX
Host, deploy & scale Blazor Server Apps
PPTX
10 tips to make your ASP.NET Apps Faster
PPTX
Getting Started with ASP.NET 5
PDF
C# Advanced L10-Workflow Foundation
PPTX
ASP.NET Core MVC + Web API with Overview
PPTX
ASP.NET Core 2.1: The Future of Web Apps
PPTX
Mini-Training Owin Katana
PPT
"Spring Boot. Boot up your development" Сергей Моренец
A Gentle Introduction to Blazor
Evolution / History of ASP.NET
Learning ASP.NET 5 and MVC 6
Introduction to ASP.NET MVC
Azure Serverless Conf
Codegen2021 blazor mobile
Introduction to Selenium Webdriver - SpringPeople
Modern Applications With Asp.net Core 5 and Vue JS 3
ASP.NET Core 1.0
Discuss About ASP.NET MVC 6 and ASP.NET MVC 5
ASP.NET Core 2.1: The Future of Web Apps
Building real time app by using asp.Net Core
Host, deploy & scale Blazor Server Apps
10 tips to make your ASP.NET Apps Faster
Getting Started with ASP.NET 5
C# Advanced L10-Workflow Foundation
ASP.NET Core MVC + Web API with Overview
ASP.NET Core 2.1: The Future of Web Apps
Mini-Training Owin Katana
"Spring Boot. Boot up your development" Сергей Моренец
Ad

Similar to Asp.net core 1.0 (Peter Himschoot) (20)

PDF
Red Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
PDF
Node.js Development Workflow Automation with Grunt.js
PPT
nodejs tutorial foor free download from academia
PPTX
Extending eZ Platform v2 with Symfony and React
PPTX
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
PDF
.NET Core, ASP.NET Core Course, Session 6
PDF
Introduction to node js - From "hello world" to deploying on azure
KEY
Nodejs web,db,hosting
PDF
Asp.Net Core MVC , Razor page , Entity Framework Core
KEY
Building production-quality apps with Node.js
PPT
nodejs_at_a_glance, understanding java script
PDF
Creating Modular Test-Driven SPAs with Spring and AngularJS
PPT
nodejs_at_a_glance.ppt
PDF
JavaScript Modules Done Right
PPTX
MVC 6 - the new unified Web programming model
PPTX
Building Web Apps with Express
PPTX
ASP .Net Core SPA Templates
PPTX
Structured Functional Automated Web Service Testing
KEY
Developing High Performance Web Apps - CodeMash 2011
PPTX
Express yourself
Red Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
Node.js Development Workflow Automation with Grunt.js
nodejs tutorial foor free download from academia
Extending eZ Platform v2 with Symfony and React
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
.NET Core, ASP.NET Core Course, Session 6
Introduction to node js - From "hello world" to deploying on azure
Nodejs web,db,hosting
Asp.Net Core MVC , Razor page , Entity Framework Core
Building production-quality apps with Node.js
nodejs_at_a_glance, understanding java script
Creating Modular Test-Driven SPAs with Spring and AngularJS
nodejs_at_a_glance.ppt
JavaScript Modules Done Right
MVC 6 - the new unified Web programming model
Building Web Apps with Express
ASP .Net Core SPA Templates
Structured Functional Automated Web Service Testing
Developing High Performance Web Apps - CodeMash 2011
Express yourself
Ad

More from Visug (12)

PDF
Gdbc keynote-visug
PPTX
Making enabling apps for disabled people
PPTX
How many iot technologies do you need to turn on a lightbulb (Kurt Claeys)
PPTX
Tfs Build vNext (Jelle Druyts)
PPTX
Sherlock Homepage (Maarten Balliauw)
PPTX
Service Fabric Overview (Yves Goeleven)
PDF
DDD, CQRS & ES lessons learned (Gitte Vermeiren)
PDF
DevOps with Visual studio Release Management (Pieter Gheysens)
PPTX
Exploring XLabs
PPTX
Hello windows 10: An overview of the new features for developers in WIndows 10
PDF
So you write JavaScript? Keep the crap out of there then!
PPTX
Visug: Say Hello to my little friend: a session on Kinect
Gdbc keynote-visug
Making enabling apps for disabled people
How many iot technologies do you need to turn on a lightbulb (Kurt Claeys)
Tfs Build vNext (Jelle Druyts)
Sherlock Homepage (Maarten Balliauw)
Service Fabric Overview (Yves Goeleven)
DDD, CQRS & ES lessons learned (Gitte Vermeiren)
DevOps with Visual studio Release Management (Pieter Gheysens)
Exploring XLabs
Hello windows 10: An overview of the new features for developers in WIndows 10
So you write JavaScript? Keep the crap out of there then!
Visug: Say Hello to my little friend: a session on Kinect

Recently uploaded (20)

PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
cuic standard and advanced reporting.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
KodekX | Application Modernization Development
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Electronic commerce courselecture one. Pdf
PPT
Teaching material agriculture food technology
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Diabetes mellitus diagnosis method based random forest with bat algorithm
Encapsulation_ Review paper, used for researhc scholars
NewMind AI Weekly Chronicles - August'25 Week I
Dropbox Q2 2025 Financial Results & Investor Presentation
The AUB Centre for AI in Media Proposal.docx
NewMind AI Monthly Chronicles - July 2025
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
cuic standard and advanced reporting.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
20250228 LYD VKU AI Blended-Learning.pptx
KodekX | Application Modernization Development
Spectral efficient network and resource selection model in 5G networks
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Electronic commerce courselecture one. Pdf
Teaching material agriculture food technology
Unlocking AI with Model Context Protocol (MCP)
How UI/UX Design Impacts User Retention in Mobile Apps.pdf

Asp.net core 1.0 (Peter Himschoot)

  • 1. ASP.NET Core 1.0 Deep Dive Peter Himschoot
  • 2. About me • Peter Himschoot • Trainer for U2U • .NET • Web • iOS • Microsoft Regional Director for BeLux • Independent developer evangelist
  • 3. Agenda • We’re going to talk about extensibility • Middleware • Tag Helpers • Customization • …
  • 6. Existing Middleware • Static files • Routing • Error Handling • MVC app.UseExceptionHandler("/Home/Error"); app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); app.UseRouter(routes);
  • 7. Your own middleware • Build class implementing • Use extension method to install it Task Invoke(HttpContext context) public static IApplicationBuilder UsePrimeChecker( this IApplicationBuilder builder, PrimeCheckerOptions options) => builder.Use(next => new Middleware(next, options).Invoke); }
  • 9. Unit Testing • Fully supported in .NET Core 1.0 • Need to add the test runner as a command "dependencies": { "xunit": "2.1.0", "xunit.runner.dnx": "2.1.0-rc1-build204", "Microsoft.AspNet.TestHost": "1.0.0-rc1-final", "IsPrime": "1.0.0-*" }, "commands": { "test": "xunit.runner.dnx" }
  • 10. Integration Testing • ASP.NET Core 1.0 supports testing website without host // Arrange var server = new TestServer(TestServer.CreateBuilder().UseStartup<Startup>()); var client = server.CreateClient(); // Act string request = "/checkprime?5"; var response = await client.GetAsync(request); response.EnsureSuccessStatusCode(); var responseString = await response.Content.ReadAsStringAsync(); // Assert Assert.Equal("5 is prime!", responseString);
  • 12. Taghelpers • Enable us to write nicer razor code • Look a lot like angular.js and knockout.js • Example: <ul class="nav navbar-nav"> <li><a asp-controller="Home" asp-action="Index">Home</a></li> <li><a asp-controller="Home" asp-action="About">About</a></li> <li><a asp-controller="Home" asp-action="Contact">Contact</a></li> </ul>
  • 13. HtmlHelper vs. Tag helper • Is there any doubt? @Html.EditorFor(model => model.Title, htmlAttributes: new { @class = "form-control"}) <input asp-for="Title" type="text" class="form-control" />
  • 14. Building a custom tag helper <ul u2u-property="Address.City" u2u-items="Model"></ul>
  • 16. Using C#6 nameof instead of strings • Again?! • I want this! • But it is not supported… • I want this! • So let’s add it… <a asp-controller="@nameof(HomeController)" asp-action="@nameof(HomeController.Index)">Home</a> <a asp-controller="Home" asp-action="Index">Home</a>
  • 17. Use the Source Luke! • Debugging with MVC Sources • Simply add path to sources in global.json { "projects": [ "src", "test", "C://Mvc//src" ], "sdk": { "version": "1.0.0-rc1-final" } }
  • 18. NuGet projects Building your own NuGet Package
  • 19. New Visual Studio projects make this easy! • Using dnu pack command

Editor's Notes

  • #13: https://github.com/aspnet/Mvc/tree/67474d8cbcfa4a18292c9edb82f5e61c43be9718/src/Microsoft.AspNet.Mvc.TagHelpers