Why ASP.NET Core

Monday, September 18, 2017

Share:

In a few weeks, our team is going to release a completely renewed version of nopCommerce - nopCommerce 4.00.
We have been working a lot over the last months and now we are proud to announce that nopCommerce is finally moved to ASP.NET Core.
ASP.NET Core is not a continuation of ASP.NET 4.6. It is a redesigned ASP.NET, brand new, cross-platform, high-performance and open-source framework.

So why we decided to move nopCommerce to ASP.NET Core?

We always try to keep nopCommerce running on the latest technologies to offer the best experience possible to our users.
ASP.NET Core is a new framework but it is already matured enough to be used as a basis for building modern, well-structured and extendable web applications such as nopCommerce. ASP.NET Core is the fully featured framework of course but let me highlight several ones making ASP.NET Core a preferable for nopCommerce particularly:

New concept

The concept of ASP.NET Core is very close to us. ASP.NET Core is open source and community-focused. The whole source code of the framework is available on GitHub.

Cross-platform

ASP.NET Core is cross-platform which means an application can be run on Windows, Mac, and Linux. Though nopCommerce still uses .NET Framework as a core, and this feature is not available for us yet. But in next versions when we finally move nopCommerce to .NET Core, developers will be able to use all the opportunities of cross-platform development.

Modular framework

ASP.NET Core ships entirely as NuGet packages. This allows us to optimize nopCommerce including selected, needed packages, which improves security and performance of the solution and reduces servicing. This also means that the framework upgrading process goes easier in general: when the new version of a package is released there is no need the whole framework to be upgraded. It gives sort of independency for a developer who can get the latest changes just by updating the packages. This is a very important feature allowing us to keep nopCommerce up-to-date constantly.

Performance

Performance is crucial for nopCommerce and ASP.NET Core suits our needs. One of the main points in performance optimization is caching. The framework supports several built-in caches.

The first one which is used in nopCommerce is based on the IMemoryCache which represents a cache stored in the memory of the web server.

The second one is distributed cache. nopCommerce uses Redis cache but doesn't use the ASP.NET Core approach yet. This will be implemented in the next nopCommerce versions.

ASP.NET Core uses Middleware

Middleware is a new lightweight high-performance and modular pipeline for requests in an application. Each part of middleware processes an HTTP request, and then either choose to return the result or pass to the next part of middleware. This approach gives a developer total control over the HTTP pipeline and encourages the development of simple modules for an application which is important for growing open source project.

ASP.NET Core MVC

ASP.NET Core MVC provides features simplifying web development. nopCommerce already uses such features as Model-View-Controller (MVC) pattern, Razor syntax, model binding and validation but the following tools are new for us:

Tag helpers. It's server-side code to participate in creating and rendering HTML elements in Razor files. What are tag helpers needed for? What features will be available?

They give us HTML-friendly development experience. Which means Razor markup using Tag Helpers looks like standard HTML. It's important for front-end designers which are not familiar with C# Razor syntax.

Now developers can use rich IntelliSense environment for creating HTML and Razor markup for the more productive development process.

ASP.NET Core provides lots of built-in tag helpers for common tasks, such as creating forms, links, loading assets etc. But besides using them, it is possible to create our own tag helpers.

View components. This is a new tool similar to partial views, but much more powerful. nopCommerce uses view components when reusable rendering logic is required and when the task is too complex for a partial view.

Dependency injection into views. Although the most of the data which views display is passed in from the controller nopCommerce has views where dependency injection is more usable.

Conclusion

Moving to ASP.NET Core is a big step forward for nopCommerce community. We have changed a lot in the nopCommerce source code, there are new approaches which are worth learning about but in the same time, it should be noted that the core concepts and business logic stay the same. As well as the controller and routing logic.
This means that despite the big changes we made, nopCommerce users familiar with previous versions of the platform can easily manage dealing with new one, based on ASP.NET Core, it shouldn’t take long. To ease an upgrading process from 3.90 to 4.00 we are going to prepare a tutorial describing it step-by-step.
We are also going to talk about the moving nopCommerce to ASP.NET Core on the nopCommerce Days conference which will be held in New York in November 2017.

New technologies are crucial for us as for the eCommerce platform. We are certain that ASP.NET Core is the future of web development in .NET and moving to ASP.NET Core will bring our community lot more opportunities for growing their business.

One of the best thing I found while looking at nopCommerce 4.0 code wad new implementation of widgets. It will just kill old performance issue that we were actually facing while using widgets and this is why we used to use some other methods.

Moreover, thanks to nopCommerce team that they actually managed to keep same architecture while moving to asp.net core and this is why we are again powerful as a nopCommerce solution provider to say "Yes, we can easily migrate your website to nopCommerce 4.0"..

It will be also better move to Dapper + Stored procedures and stop using Entity framework.If you emotionally attached to Entity framework at least use Command Query parent and not repository's.https://app.pluralsight.com/library/courses/clean-architecture-patterns-practices-principlesMoving to .net core will not increase performance.

I have a build on going with the current iteration of 4.0 - I must say it is absolutely fabulous. Performance is off the scale! I'm staging on a $4 AWS instance and i'm actually STAGGERED at the performance.

Looking forward to 4.0at Tmotions we already have upgraded some of our .Net projects and .Net Core and the team is now well trained on the new framework. We look forward to upgrading our customer's nopCommerce platforms to 4.0 soon