The Ultimate Guide For Selecting The Right DotNet Framework For Your Project
.NET (pronounced as “dot net”) – is a familiar term to many and unknown to others. Microsoft is the developer of DotNet technology, and the Windows OS powers this software. Since the first release of the DotNET framework, Microsoft has continuously worked and introduced the various functions. Today, we will go through the structures in brief and technologies built within it. The parent company has come up with the following changes since the introduction of the software.
- Framework version upgrade
- New features
- Security improvements
- Visual Studio versions and upgrades
Microsoft introduced the .NET framework in the late 1990s, and by late 2001 the first beta version of .NET framework 1.0 was released. Since then, the parent company has upgraded the .NET frameworks ceaselessly. Two of the major upgrades include framework 2.0, and 4.0 and with each of the new versions, it ceases to amaze the world with new features. Such changes make the developer’s life easy and offer new functionality that aims to fulfill customers’ requirements.
Let’s have a look at the architecture of the .NET framework before we go into the individual framework and its features.
CLI (Common Language Infrastructure)
Common Language Infrastructure provides a language equitable platform for building and executing applications. With CLI, the .NET framework provides supports for multiple languages supported by a framework such as C#, VB.NET, and J#.
CLR (Common Language Runtime)
- Common language runtime is responsible for executing .NET programs runtime. Apart from this, it also provides services such as security, memory management, type safety, garbage collection, thread management, and exception handling.
- JIT (Just-in-time) compiler converts code into machine instructions, which are later executed by the server/computer.
FCL (Framework Class Library)
Framework class library is responsible for providing support for several programming languages such as C#, VB, F#, etc.
It’s a collection of classes, interfaces, value types and includes implementation of base class libraries.
There are two types of assemblies:
1) Process Assemblies (.EXE)
A ‘process assembly’ represents a process that is defined in library assemblies.
2) Library Assemblies (.DLL)
Dynamic-link library is the implementation of the ‘shared-library-concept’ using which codes are shared into multiple different applications.
Each assembly file must have metadata for the assembly. The name of the assembly file generally includes name, version number, culture, and public token, etc.
App models are used to create applications. .NET framework support app model for Console, Windows Forms, ASP.NET, Windows Presentation Foundation (WPF), and .NET Core applications.
Now that we know the various components of DotNet – let’s look at a few more essential questions to be kept in mind while working with the framework.
- Alternatives available in .NET when you want to create a web application
- How to choose which framework best suits your needs
Frameworks within .NET Family
1) WEB Forms
.NET web pages, officially known as Web forms, marked its release in 2002 with ASP.NET framework 1.0. It is a web application framework built upon ASP.NET technology, and its application can be written in C# or VB.NET.
- Server Controls
Many of the server controls are familiar to HTML controls. When a web page is requested, the HTML is rendered and sent back to the browser.
- Master Pages
A master page is used to define a consistent layout that is shared across multiple ASPX pages.
URL Routing allows applications to accept request URLs that don’t map to physical ASPX files. It’s a virtual mapping between the requested URL and the physical file.
- State Management
State management allows us to preserve data per page and application-wide.
Ranging from tampering, spoofing, denial of service to information disclosure, etc. there are many things Microsoft provides to make an application more secure.
ASP.NET web forms allow you to modify and improve performance related to a web page, state management, control processing, application configuration, and efficient coding practices.
- Debugging and Error Handling
Debugging and error handling features are supported in ASP.NET web forms. They allow an easy way to compile, debug, and run the code to find and solve any unexpected errors.
ASP.NET, IIS, and Visual studio provide tools to deploy your ASP.NET web application.
When should you choose WEB Forms
- To preserve the data over HTTP, you must consider state management and server control events.
- If you are developing less complex applications, it can be put to use; since WEB Forms are tightly integrated, and only one person can work on one web page at a time.
- If you have a small team with limited developers and designers and want to perform rapid development, then it the perfect platform.
- If there are frequent and rapid development and deployment required, then you may use Web forms.
The ASP.NET MVC framework is an alternative provided by Microsoft for creating web applications. Model-View-Controller pattern separates code and presentation that makes it lightweight, highly testable, and loosely coupled.
- Separation of Concerns
Model-View-Controller patterns allow separation of code, presentation, and input logic that allow fast and flexible unit testing.
- Extensible and Pluggable Framework
MVC is built upon an easily replaceable and highly customized pattern.
a) Dependency Injection (DI) allows you to inject objects into any class.
b) Inversion of Control (IOC) specify if any object requires another object.
- Powerful Routing
A strong and useful URL mapping component that does not include file extension is highly preferred by SEO and REST addressing.
- Support for existing markup
MVC framework provides support for existing markup concepts of WEB forms, such as ASP.NET pages (.ASPX), user controls (.ASCX), and master pages (.master) files.
- Support for existing ASP.NET features
MVC framework provides support for existing .NET features such as Windows authentication, URL authorization, membership and roles, profile and state management, output and data caching, etc.
When should you choose MVC
- If you have a complex application and you want to divide it into separate parts such as design, code, and input logic, etc.
- MVC is ideal when you want full control over the behavior of the web application.
- If you want a test-driven development, then MVC is the perfect fit.
You have a large team of developers and web designers to build and maintain the web application.
3) .NET Core
.NET Core is a free, open-source, and cross-platform framework for building modern, cloud-based apps on Windows, Linux, and macOS. .NET Core was first released in 2016 and was primarily developed by Microsoft and then released under MIT license.
- Cross-Platform and Containers
Runs on Windows, Linux, and macOS
- Built-in Dependency Injection
The most painful issue of a developer was resolved in new ASP.NET Core when built-in support provided for dependency injection. It provided an easy way for injecting DB context, logging context, and others into the controller.
It allows the servers to send asynchronous web-based real-time notifications to online users.
- Self-hosted Webapps
ASP.NET Core can be hosted on IIS or is self-hosted.
When to choose .NET Core
- Cross-platform needs
If applications need to run on multiple platforms such as Windows, Linux, and macOS, then .Net Core is an apt platform.
- Microservices architecture
The microservices architecture works with other microservice or other services.
Containers are used along with microservices.
- Running multiple .NET versions parallelly
.NET Core supports the installation of different versions on the same server. Running multiple versions of .NET core parallelly provides ease and saves time and cost behind application upgrades and operations.
The DotNET Core application may be hosted on the following
- High-performance and scalable system
.NET Core and ASP.NET Core can be the best options when used with microservice(s) for developing a scalable and high-performance application.
Microsoft began by providing basic features in the initial .NET framework. Despite new technology that has been introduced over the years, Microsoft .NET frameworks continue to remain on top when it comes to large scale, complex, and stable web development, Web forms, MVC, and .NET Core provide good features, but ever since ASP.NET Core’s introduction, it became popular, and rapidly adopted by developers. On a personal note, I would prefer to migrate with the latest technology whenever possible. However, picking the right technology depends on application requirements, features, and support of the framework. Feel free to get in touch if you have any questions about choosing the right one for your requirements!