Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Migration from ASP.NET MVC to ASP.NET Core

15 views

Published on

In its time, ASP.NET MVC has started a revolution within Microsoft, not just regarding the web application development model, but for including the third-party open source libraries which was unthinkable in Microsoft world until that point. However, it’s time to upgrade. ASP.NET is a modern multi-platform web framework built from scratch, with a similar development model to its predecessor. It marks a new revolution - Microsoft totally adopting open source. In this talk we’ll go over the advantages of the new framework, what should we care about when migrating to Core, the problems we might encounter, tips & tricks for migration process and the differences between these two platforms.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Migration from ASP.NET MVC to ASP.NET Core

  1. 1. Advanced Technology Days 5. i 6. prosinca 2018., Plaza Event Centar Powered by
  2. 2. ADVANCED TECHNOLOGY DAYS Migration from ASP.NET MVC to ASP.NET Core Miroslav Popović https://miroslavpopovic.com @miroslavpopovic
  3. 3. Medijski sponzori Sponzori konferencije Prijatelj konferencije
  4. 4. Introduction
  5. 5. A bit of history • .NET Framework 1.0 • ASP.NET 1.0 • ASP.NET 2.0 • ASP.NET MVC • ASP.NET WebAPI • ASP.NET Core & .NET Core
  6. 6. Why migrate? • Old platform, no longer improved • Performance is not that great • System.Web dependency • Windows only • Using it with containers is harder • Running multiple side-by-side installations is harder • Configuration is harder • Doesn’t play well with modern web
  7. 7. Why not stay?
  8. 8. ASP.NET Core benefits • Multiplatform • Open source for real • Performance • New configuration system • Easy to use with Docker • Side by side with another app on different .NET Core • Joined MVC and WebAPI • Excellent for REST APIs • Plays great with modern web tools
  9. 9. Shiny new toy
  10. 10. .NET Standard
  11. 11. Migration from ASP.NET MVC
  12. 12. Migration process • Latest version of .NET Framework (at least 4.6.2) • Analyze your solution with .NET Portability Analyzer • Migrate non-ASP.NET projects to .NET Standard • Create new ASP.NET Core 2.1 project • Migrate startup code and initialization • Migrate static files, configure bundles • Migrate views and actions
  13. 13. Project organization
  14. 14. Project files SDK-style projects
  15. 15. Middleware pipeline
  16. 16. Startup
  17. 17. Razor changes
  18. 18. Tag helpers and client libs
  19. 19. Web Components • Dynamic navigation menus • Tag cloud (where it queries the database) • Login panel • Shopping cart • Recently published articles • Sidebar content on a typical blog
  20. 20. WebAPI • Same controllers as for MVC • Configuration in Startup • [ApiController] • ActionResult<T> • Swagger / Open API specification • HTTPS by default • API conventions • API analyzers
  21. 21. Potential problems
  22. 22. .NET Core & .NET Standard • .NET Portability Analyzer • Not all APIs are migrated to Core • Registry access • WCF servers • AppDomain • Remoting
  23. 23. Database access • Depends on DB library used • Direct ADO.NET access • Micro ORMs • NHibernate • Entity Framework
  24. 24. Entity Framework Core • Different than EF6.x • Migrations • Still not feature-ready • Plans to have EF6 working on .NET Core 3.0
  25. 25. ASP.NET Identity • Database changes • View changes • Scaffolding
  26. 26. Closing words
  27. 27. When not to migrate? • ASP.NET Web Forms • ASP.NET MVC Web Forms • Missing APIs • Old dependencies • … • Rewriting parts of solution
  28. 28. ASP.NET Core future present • ASP.NET Core 2.2 • .NET Core 3.0 • ASP.NET Core 3.0 • …
  29. 29. Are you convinced? • Performance, performance • Features ‐ some free, some with additional work • Open-source • Modern web framework • Dockerizable • Future • …
  30. 30. Guides and tools • Migration docs ‐ https://docs.microsoft.com/en-us/aspnet/core/migration/proper-to-2x/?view=aspnetcore-2.1 • Should, When, and How Can I Migrate to .NET Core – Mitchel Sellers ‐ https://mitchelsellers.com/blogs/2018/07/19/should-when-and-how-can-i-migrate-to-net-core • .NET Portability Analyzer ‐ https://docs.microsoft.com/en-us/dotnet/standard/analyzers/portability-analyzer ‐ https://github.com/Microsoft/dotnet-apiport • Migrate project files tool ‐ https://github.com/hvanbakel/CsprojToVs2017
  31. 31. Medijski sponzori Sponzori konferencije Prijatelj konferencije Hvala.

×