Top Banner
vNext THE FUTURE OF ASP.NET
23
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ASP.NET vNext the future of ASP

vNextTHE FUTURE OF ASP.NET

Page 2: ASP.NET vNext the future of ASP

Where we go?ASP : Summary

New structure + Demo

OWIN

Grunt

Bower

Dependancy Injection + Demo

Kruntime + Demo

OmniSharp & YO

Page 3: ASP.NET vNext the future of ASP

ASP : Summary (1/2)

ASP.NET = 2002 :◦ Webform, (ViewState)

◦ System.Web (releases sync with releases of the framework)

◦ HttpContext (designed for webform)

More than 30Ko of server’s memory each request (HttpContext)◦ Even for REST API’s !

Page 4: ASP.NET vNext the future of ASP

ASP : Summary (2/2)ASP .NET MVC = 2007

◦ MVC, WebAPI, SignalR, Razor are all Nuget packages

WebAPI = 2012

ASP.NET vNext = 2015◦ OWIN (Open Web Interface for .NET - Katana)◦ CIAO system.Web!◦ Modular framework in packages◦ Cloud optimized (200 -> 10MB for the framework)◦ Official support of Mono (mono in integration build)◦ Grunt and Bower integration◦ Kruntime: deal framework packages thanks to KVM & KPM◦ Dependancy injection built-in◦ EF7 (Wphone , Mono Azure & SQLite(?) compliant)◦ Identity 3◦ …

Page 5: ASP.NET vNext the future of ASP

New structure! (1/2)Solution items

◦ Global.json : information about solution

Src : contains projects, source files (not unit test)

Wwwroot : static files (scripts, css, pictures, font,…)

Config.json: new config file

Project.json : contains all packages used and dependancies (ex: asp.net MVC), file for NuGet

Startup.js (entry point for OWIN (before: global.asax)) :◦ Startup : Setup configuration

◦ ConfigureServices : called by the runtime: loads EF, Identity, MVC, Singleton for DI

◦ Configure : called after after ConfigureServices : loads and configure

◦ HTTP request pipeline, identity, error handling, routing, …

Page 6: ASP.NET vNext the future of ASP

New structure (2/2)Global information on the project

◦ WebRoot: web server root (public folder)

◦ Metadata as version, authors, description

◦ Things to exclude for compilation

Dependencies section lists :◦ all the dependencies of your application

Target frameworks that will be built, and dependencies that are specific to the configuration.

Page 7: ASP.NET vNext the future of ASP

DemoLaunch of starter

The new compiler Roslyn is there! (control+F5 in order to use the AOT compilation : build is donewhen you save, VS just do semantic check)

Page 8: ASP.NET vNext the future of ASP

OWINOpen Web Interface for .NET runs MVC applications on a very thin Katana server, or on a Project Helios managed IIS instance.

Interaction between webhost and web app that allow to be ran on different platforms (Linux, OSX, Windows) thanks to their 4 layers:

Page 9: ASP.NET vNext the future of ASP

GruntGrunt = JS Task-Runner

◦ Automate everything !◦ CSS concat

◦ JS minifier

◦ Picture optimization

◦ …

◦ Package.json ->

◦ GruntFile.js

Page 10: ASP.NET vNext the future of ASP

BowerClient-side package manager (dependency mgmt tool)

Configuration in bower.json

Page 11: ASP.NET vNext the future of ASP

Dependancy Injection (1/5)

Dependency Injection" is a 25-dollar term for a 5-cent concept. [...]

Dependency injection is basically providing the objects that an object needs (its dependencies) instead of having it construct them itself. It's a very useful technique for testing, since it allows dependencies to be mocked or stubbed out.

Dependency injection == giving an object its instance variables.

Page 12: ASP.NET vNext the future of ASP

Dependancy Injection (2/5)Example application that shows TODO items

The demo front-end just show the items but there are some backend methods as example.

Page 13: ASP.NET vNext the future of ASP

Dependancy Injection (3/5)TodoRepository that implements ITodoRepository

Page 14: ASP.NET vNext the future of ASP

Dependancy Injection (4/5)Controller

Page 15: ASP.NET vNext the future of ASP

Dependancy Injection (5/5)ConfigureServices is the global place where dependencies are registered that can be used through the whole application stack.

AddSingleton method register the Interface and the specific implementation of the global DI container.

Page 16: ASP.NET vNext the future of ASP

Demo !Let’s launch that beautiful app ( sorry, no more pictures )

Page 17: ASP.NET vNext the future of ASP

K* (1/2)KRE = K Runtime Engine : code to bootstrap apd run ASP.NET vNext (Compilation system, SDK, tools, CLR hosts, …). KRE = packages !

KVM : K Version Manager : to manage install different version of KRE present on the machine. Usedto set default KRE version (powershell script)

KLR = K Language Runtime: used to launch one self hosted app. When used, KLR find and launch CLR native host of the app

KPM : K Package Manager : to manage NuGet packages and dependancies needed to run the app

Page 18: ASP.NET vNext the future of ASP

K* (2/2)Kvm help !!!

kvm list : list all versions of the framework and the one that is selected (the one with a *). Whenthere is a « C », it’s cloud optimized!

Kvm alias default 1.0.xxx (and restart VS) : put alias default to 1.0.xxx

Kvm use 1.0.xxx : set active version for machine

Kvm use default : set active version for machine but by specifying that one that is default

k run: execute the application on CLI & K web: for webapplication

K web --server.urls=http://localhost:5001 in order to specify url if not specified in config file

Page 19: ASP.NET vNext the future of ASP

Demo

Test project with commands!◦ Console

◦ Web

◦ Web with different version of runtime

Page 20: ASP.NET vNext the future of ASP

OmniSharpTool To enable great .NET development in lots of editors:

◦ Atom

◦ Sublime text 3

◦ Brackets

◦ VIM

◦ Emacs

◦ CLI

Page 21: ASP.NET vNext the future of ASP

YO !Yeoman : tool to generate code : a scaffolding too for aspnet from the CLI:

Page 22: ASP.NET vNext the future of ASP

Question?

Page 23: ASP.NET vNext the future of ASP

Sourceshttp://en.wikipedia.org/wiki/ASP.NET_MVC_Framework

http://developer.telerik.com/featured/microsofts-special-k-an-introduction-to-asp-net-vnext/

http://gruntjs.com/

http://gunnarpeipman.com/2014/10/asp-net-5-new-structure-of-solutions-and-projects/

http://www.omnisharp.net/

https://robinsedlaczek.wordpress.com/2014/11/22/dependency-injection-in-asp-net-vnext/

http://fiscammc.com/wordpress/category/owin/

www.owin.com

www.yeoman.io

www.omnisharp.com