Why Convert to .NET Core from ASP.NET MVC?

We are doing lots of work on .NET Core at since 2014. During all these years, We are making sure that our app tools performance should be up to date. Its prefix and retrace can be used to .Net Core-based applications. We have changed the whole code or prefix to the core for running this code on Mac.

Using xproj and csproj files together
  • If your current setup with your build server is not working properly then it is better to use xproj and csproj files together at the same time.
  • It will help to end up your Windows-targeted builds of the prefix. It is not important that two project types may resemble each other then you have to move all to xproj but MSBuild will be of no use then after.
.NET Standard vs .NET Core App1.0

The major difference between these two is that: .NET Standard is designed to set common standards to target common standards in .Net 4.5, Core, UWP, Xamarin, etc. Thus for making a shared library based on the nugget package, Net Standard is the best option.

On the other hand, If an actual application is being under planning then to target .NET Core App 1.0 as the framework you should target .NET 4.5.1 OR Later versions. It can be deployed on Mac or Linux also. For targeting windows you can directly target too .Net 4.5.1.

HttpModules and HttpHandlers are replaced by new “middleware”
  • For substituting the modules and handlers middleware has been introduced. These are same as Owin and other languages which handle this kind of functionality.
  • For more information, you can go through ASP.NET. it is very easy in working. It has a drawback that it can’t be configured in the config file. It will be a set of codes.
FileStream moved to System.IO.FileSystem
  • Generally, classes were used earlier which now is being converted into different packages.
  • FileStream is totally removed from the System.IO assembly package or reference. System.IO.FileSystem package is to be added in the system explicitly. It is somehow confusing as we are using the class namespace which did not match to the packages.
Platform-specific code like Microsoft specific RSA
  • .NET Core is being introduced to run on an operating system like Windows, Mac, LINUX etc but it is not possible because sometimes the code which is compiling on windows will become failed at runtime when it is run on Mac or Linux.
  • RSACryptoServiceProvider is an example of such case which is useful. On Mac “platform not supported” type exception will occur at runtime.
  • This RSA provider API is just for Windows. In place of using RSA API’s, you can use RSA.Create() which is generic implementation and has different methods. This both are present in System.Security.Cryptography. It is slightly confusing.
Newtonsoft changed to default to camel case on field names
  • It is the most difficult conversion among all. Newtonsoft now defaults to camelCase. If you are using PascalCase then it will cause to all sorts of REST APIs. Lastly, we use the JsonProperty attribute on some attributes to force their casing at the end which is our main motive.
DataSet and DataTable doesn’t exist
  • DataSet and DataTable are still being used by some people. DataTables is being used to send a table to a SQL stored procedure as an input parameter.
Creating a Windows Service in .NET Core: 
  • Visual Studio 2017 can create Windows Services as your code targets to full .NET Framework.
  • You have to convert your .NET Core code to a class library which targets Net Standard which can be shared via other .NET Core app and your Windows Service.

If you’re stuck between ASP.NET to .NET Core migration, We’re happy to assist you. Schedule meeting to easily hire .NET Developers for your needs.

Leave a Comment