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.
2. tweet #tarabica19
Migration from ASP.NET MVC to ASP.NET Core
Belgrade
May 25th, 2019
Miroslav Popović
Technical Lead, Seavus Group
https://miroslavpopovic.com
@miroslavpopovic
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
tweet #tarabica19
6. Why migrate?
• Old platform, no longer improved
• .NET Framework 4.8 is the last version
• 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
tweet #tarabica19
8. ASP.NET Core benefits
• Multiplatform
• Open source for real
• Performance
• New configuration system
• Easy to use with Docker
tweet #tarabica19
9. ASP.NET Core benefits (cont.)
• Side by side with another app on different .NET Core
• Joined MVC and WebAPI
• Excellent for REST APIs
• Plays great with modern web tools
• Part of the .NET future
tweet #tarabica19
13. 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+ (or 3.0) project
• Migrate startup code and initialization
• Migrate static files, configure bundles
• Migrate views and actions
tweet #tarabica19
20. 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
tweet #tarabica19
21. Web API
• Same controllers as for MVC
• Configuration in Startup
• [ApiController]
• ActionResult<T>
• Swagger / Open API specification
• HTTPS by default
• API conventions
• API analyzers
tweet #tarabica19
23. .NET Core & .NET Standard
• Not all APIs are migrated to Core
• .NET Portability Analyzer
• Registry access
• WCF servers
• AppDomain
• Remoting
tweet #tarabica19
24. Database access
• Depends on DB library used
• Direct ADO.NET access
• Micro ORMs
• NHibernate
• Entity Framework
tweet #tarabica19
25. Entity Framework Core
• Different than EF6.x
• Migrations
• Still not feature-ready
• Entity Framework 6.3 migrated to .NET Core 3.0
tweet #tarabica19
28. When not to migrate?
• ASP.NET Web Forms
• ASP.NET MVC Web Forms
• Missing APIs
• Old dependencies
• …
• Rewriting parts of solution
tweet #tarabica19
33. Are you convinced?
• Performance, performance
• Features
• some free, some with additional work
• Open-source
• Modern web framework
• Dockerizable
• Future
• …
tweet #tarabica19
34. Guides and tools
• Migration docs
• https://docs.microsoft.com/en-us/aspnet/core/migration/proper-to-2x/?view=aspnetcore-2.2
• 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
tweet #tarabica19