Why Web developers need to move to .NET Core and using ASP.NET MVC Core to build Web and We…

This is my personal opinion and I have a good reason to recommend developers to move to .NET Core instead of .NET Framework . Some might disagree with my opinion, but hey, it’s good to share thoughts and to discuss it. I’m not going to tell what is .NET Framework as you can just Google it, but I can assure you that .NET Framework will only be runs on Windows Operating System .

Drawing The Line

There will always be a reason for developers or their team lead to saying that their system is still using old system which is obviously happen to enterprise developers. So, I will draw some lines on who should move to using .NET Core instead of .NET Framework. Here is what is in my mind:

  1. If you are a maintainer of a legacy Windows services backend, web apps or web services, than you need to keep using .NET Framework for now.
  2. If your apps will be deployed on an old Windows Server machines, than you might want to stick with .NET Framework for now.
  3. If you are a VB developers which only relied on VB.NET language, than you have to use .NET Framework.
  4. If you are sure that your system won’t be deployed to a cloud very soon, than you can stick with .NET Framework for now.
  5. If you are stuck without any option whatsoever to use .NET Framework, than you need to continue using .NET Framework.

Beginners, just learn .NET Core instead!

If you are a beginners learning ASP.NET or ASP.NET MVC, you probably don’t know what is .NET Framework and .NET Core is. No worries! I suggest and recommend that you look at the documentation and you can see the comparison and the differences easily. And just use .NET Core instead of .NET Framework. Here is what I can share some of the bits of both .NET Framework and .NET Core and you can click on each links to get the tools to start developing.

.NET Framework .NET Core
TechnologyFirst Release 2002 (Mature)First Release 2016 (Mature)
Latest Version 4.7.1 ( Open Source Software ) 2.1.3 ( Open Source Software )
SDK Windows Only (Version 7, 8, 10) Windows (Version 7, 8, 10),
Linux (redhat, Ubuntu >14.04, Fedora, Debian, CentOS 7, openSUSE 24, Oracle Linux 7, SLES 12),
ASP.NET Performance57,843 Request/Seconds (Plain Text) 1,822,366 Request/Seconds (Plain Text)
Here is some real world news as reference: ASP.NET Core – 2300% More Requests Served Per Second .
Best IDE/Editor Visual Studio 2017 Community (latest, FREE) Visual Studio 2017 Community (latest, FREE),
Visual Studio Code for Windows, Linux and Mac (FREE),
Visual Studio for Mac Community (FREE)
Web Framework Web Form, ASP, MVC ( Web and Web API ) MVC Core ( Web , Razor Page , Web API )
Entity Framework (ORM) Entity Framework 6.2 (latest)
(Microsoft SQL Server, Oracle, MySQL (Official), PostgreSL, SQLite, IBM Data Server (DB2))
Entity Framework Core 2.0.1 (latest)
(InMemory (for Testing), Microsoft SQL Server, SQLite, PostgreSQL (Npgsql), IBM Data Server (DB2), MySQL (Official), MySQL
(Pomelo), Microsoft SQL Server Compact Edition, Devart (MySQL, Oracle, PostgreSQL, SQLite, DB2, and more),
Oracle (not yet available), MyCat, Firebird-Community)
FrontendPlain MVC, Angular (mostly using MVC)Plain MVC, Angular, React, and Redux

5 Minutes Start for .NET Core

If you already have a laptop while reading this, download and install JUST the .NET Core SDK based on your Operating System (Windows, Linux, Mac). You don’t have to install Visual Studio 2017 first to develop using .NET Core. Once you have installed the SDK, open Command Prompt or PowerShell (in Windows), Terminal (in Linux or Mac), type this:

dotnet new console -o myApp

cd myApp

dotnet run

Done! Congratulations, you just create your first Console App using .NET Core. Now you can deploy by publishing this app to any platform you want. Example for publishing to be run on Mac machine,

dotnet publish --runtime osx-x64

or for Android,

dotnet publish --runtime Android

Here is the full list of the runtime identifier catalog .

Migration to ASP.NET Core means Migrate to Modern Web App

Can I just migrate to ASP.NET Core? Easy answer is No, you cannot do it directly ! You cannot just open Visual Studio 2017 and open your old ASP.NET Web Forms or MVC 5 to ASP.NET MVC Core. Here is my strategy for migration of old codes,

  1. If your current web app is using Web Forms , you CANNOT directly convert or migrate to ASP.NET Core. Why, because Web Form and MVC has different architecture model. MVC uses separation of Model, View and Controller. Also has no web form Controls components like in Web Forms. ASP.NET MVC Core uses pure HTML5 elements. You can create a TagHelpers to create custom HTML attributes which will be converted in to normal HTML5.
  2. If your current web app is using ASP.NET MVC 5, you can copy-paste SOME of the codes to ASP.NET Core. This will need a bit of tweaking, especially on the Razor Page side. You have to create a new ASP.NET MVC project first.
  3. If your current web app is just a Web API backend, you can copy-paste SOME of the codes to ASP.NET Core Web API project. You may need to create a new Web API project first, than copy some of the codes. Tweaking is required here as ASP.NET Core Web API is using Web API 2.

If your codes are properly develop by following S.O.L.I.D Principle , I believe, the migration should be easy and not so many tweaking. However, if your code is like spaghetti than my rule of thumb is Re-Code entire application and fork as many non-dependent codes from the old projects. It is better to do it now rather than not. The good thing is, you get to learn something new and including mistakes. The benefit is, your new web app will have better performance, modern and maintainable.

Say to your Boss: Move to .NET Core

I know what your boss will reply, yes, that horror statement, “ is it compatible?

My suggestion, say: “ YES, it is Compatible! It’s just .NET. But we need some tweaking and some need small coding changes

While I’m not forcing anyone to use .NET Core, but you can see the strategy and the lines that I have mentioned above. The spirit here is, if not now, then when? It’s is 2018 now and everything has changed. Technologies has changed ( Modern Web Apps , Mobile, Augmented Reality, etc.), infrastructure has changed ( Cloud ), development architecture has changed ( Containers, Serverless ), etc.

Not that Easy

Of course. But, does not mean cannot. It require a courage and knowledge. I hope that will give some insight facing 2018. Enjoy, Happy New Year 2018 and Happy Coding!

May the .NET Force Be With You!

Resources FREE eBooks:

Architecting Modern Web Applications with ASP.NET Core and Microsoft Azure

Web Applications with ASP.NET Core Architecture and Patterns guidance

责编内容来自:Riza Marhaban (源链) | 更多关于

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合技术 » Why Web developers need to move to .NET Core and using ASP.NET MVC Core to build Web and We…

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录