Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ASP.NET 5: How to Get Your Cheese Back

ASP.NET 5: How to Get Your Cheese Back

CodeMash 2016 (Sandusky, OH)


Tugberk Ugurlu

January 08, 2016

More Decks by Tugberk Ugurlu

Other Decks in Programming


  1. ASP.NET 5: How to Get Your Cheese Back Tugberk Ugurlu

    Redgate Software @tourismgeek http://tugberkugurlu.com
  2. @tourismgeek tugberkugurlu.com github.com/tugberkugurlu stackoverflow.com/users/463785/tugberk

  3. @redgate @RedGateCareers red-gate.com/careers

  4. TWO PARTS OF THE STORY #codemash

  5. YOU #codemash

  6. You Had (Ezine Cheese) #codemash

  7. Now, You Have #codemash

  8. #sadpanda #codemash

  9. But, wait! #codemash

  10. VALUE #codemash

  11. #codemash

  12. #codemash

  13. Problem • ASP.NET 5 is a complete rewrite • It

    has new concepts like DNX, DNU, DNVM • There are new challenges ahead (*cough* dotnet CLI *cough*) • Figuring out to invest time to adopt #codemash
  14. Expectations • Not a 101 talk on ASP.NET 5. •

    There are some slides • It will not give you all the answers but will give an idea. #codemash
  15. Agenda • Going through most important changes • With samples,

    advantages and the value #codemash
  16. New Project Structure • Folder-based source • project.json, no more

    csproj. • Unified dependency management • webroot folder, seperation of the assets and app directories #codemash
  17. New Project Structure: Advantages • No more merge conflicts on

    csproj • Your sanity is preserved™ • More aligned with other ecosystems • Easy to work with client side assets • webroot concept makes it easy to separate the concerns #codemash
  18. DEMO Show me the code! #codemash

  19. Command-line First Development • Three new command line tools: •

    dnvm: .NET Version Manager • dnx: .NET Execution Environment • dnu: DNX Utility • All the operations (build, pack, publish, etc.) can be done through command line • Of course, works the same under every available platform #codemash
  20. Command-line First Development: Advantages • One important step on being

    code editor agnostic • More aligned with other ecosystems (e.g. Ruby, Go, Node.js, etc.) #codemash
  21. DEMO Run some commands! #codemash

  22. Modular, Composable HTTP Pipeline • Nothing is on the pipeline

    unless you want it to • You are in-charge of building your pipeline. #codemash
  23. Modular, Composable HTTP Pipeline: Advantages • You don't pay the

    price for the stuff you don't use • You have the same pipeline and behavior between servers • More aligned with what other stacks do (e.g. Go, Node.js) #codemash
  24. DEMO Show me the code! #codemash

  25. Dependency Injection All the Way Down • Everywhere is testable,

    even Program.Main :) • Easy to get a hold of runtime dependencies • Built in DI container, can be replaced with your favorite #codemash
  26. DEMO Show me the code! #codemash

  27. Embrace Existing Ecosystems for Client Side Assets • bower: up-to-date

    dependencies. • No need to commit them into your source control system. • client side build • Bundling, minification, compile, etc. • being able to use nodejs tools like gulp, grunt which have up-to-date of everything. • No extra learning curve • Easily deploy to CDN #codemash
  28. DEMO Show me the code! #codemash

  29. New Configuration Model • Chained, ordered set of configuration providers

    • XML • JSON • INI • Environment Variables • In-memory • Customizable, you can have any format you like • No more config transforms #codemash
  30. DEMO Show me the code! #codemash

  31. Unified MVC and Web API • No more confusion (e.g.

    which AuthorizeAttribute is which) • MVC can be now self-hosted, no ties to System.Web #codemash
  32. DEMO Show me the code! #codemash

  33. Code Editor Agnostic • Top-notch Visual Studio Tooling Support with

    VS 2015 • OmniSharp to back other code editors • Atom • Sublime • VS Code • Emacs • Yeoman generators #codemash
  34. Multiple framework targets • No more link source file compilation

    magic to get multi platform compile work • Cross compile for different framework targets (.NET Core, Good Old .NET, etc. #codemash
  35. Cross Platform! • Windows, Linux, OS X • Build and

    run cross-platform ASP.NET apps in supported platforms • Kestrel: new web server on top of libuv for Linux and OS X • Docker #codemash
  36. MORE DEMO Show me the code and linux! #codemash

  37. What about tools and libraries? • Existing libraries are OK

    under full .NET Framework DNX versions • Some libraries started porting to .NET Core: • Autofac • Serilog • Elasticsearch .NET Client • Community puts effort to port some: • Neo4jClient: https://github.com/Readify/Neo4jClient/pull/140 • MongoDB .NET Client: https://github.com/mongodb/mongo-csharp- driver/pull/210 #codemash
  38. #codemash

  39. What about tools and libraries? • Tools also started supporting

    DNX based apps #codemash
  40. Redgate ANTS Performance Profiler #codemash More info: http://bit.ly/1JU0IXR

  41. Redgate ANTS Memory Profiler #codemash More info: http://bit.ly/1JU0IXR

  42. Glimpse: https://github.com/Glimpse/Glimpse.Prototype #codemash

  43. Summary • Cross Platform (Windows, OS X, Linux, etc.) •

    Multiple Target Frameworks and CoreCLR • More aligned with other stacks (e.g. Go, Ruby, Node.js, etc.) • New Project Structure • Command-line first Development Environment • Modular, Composable HTTP Pipeline • Dependency Injection All the Way Down • Embrace Existing Ecosystems for Client Side Assets • New Configuration Model • Unified MVC and Web API • Code Editor Agnostic (VS, VS Code, Atom, Sublime, etc.) #codemash
  44. There are more… • Open source! • In-memory compilation •

    No ties to MSBuild whatsoever, choose your own build tool • Brand new Data Protection APIs • http://docs.asp.net/en/latest/security/data-protection/index.html • Secret Manager • Tag Helpers (approach them with caution!) • Entity Framework 7 • ASP.NET Identity 3 • And even more... #codemash
  45. #codemash https://twitter.com/tourismgeek/status/681435675258925056

  46. Presentation Resources Samples github.com/tugberkugurlu/aspnet-5-samples github.com/tugberkugurlu/aspnet-5-samples/tree/codemash (permalink) ModernShopping Sample https://github.com/tugberkugurlu/ModernShopping #codemash

  47. More Resources • ASP.NET GitHub Org: https://github.com/aspnet • ASP.NET Home

    Repository: https://github.com/aspnet/Home • ASP.NET 5 Docs: http://docs.asp.net • Progressive .NET Tutorials 2015 and Recording Videos of My ASP.NET 5 Talks: http://bit.ly/1L64i2o • Introduction to ASP.NET 5: http://docs.asp.net/en/latest/conceptual-overview/aspnet.html • DNX Overview: http://docs.asp.net/en/latest/dnx/overview.html • Introducing ASP.NET 5: https://channel9.msdn.com/Events/Build/2015/2-687 • Deep Dive into ASP.NET 5: https://channel9.msdn.com/Events/Build/2015/2-726 • Deep Dive into Microsoft ASP.NET 5: https://channel9.msdn.com/Events/Ignite/2015/BRK4703 • What's New with ASP.NET 5: https://channel9.msdn.com/Series/Whats-New-with-ASPNET-5 • ASP.NET 5 Community Standups: http://bit.ly/1KKYI37 • My ASP.NET 5 Posts: http://www.tugberkugurlu.com/tags/asp-net-5 and http://www.tugberkugurlu.com/tags/asp-net- vnext • ASP.NET MVP Summit Sessions: https://channel9.msdn.com/Events/ASPNET-Events/ASPNET-Fall-Sessions #codemash