In this post on Understanding the Architecture of the .NET Framework, I will explain the layered architecture of the .NET Framework. Basically, .NET is a powerful framework that lets you build software applications on Windows. In fact, it has a vast library that makes software development easier and productive on the Windows Platform. To emphasize this point, the .NET Framework is primarily used for development in the Windows platform. However, it is also available for Linux and Mac OS.
The architecture of the .NET Framework comprises several layers as evident from the following diagram.
The architecture of .NET Framework
Let us discuss each layer of the .NET Architecture one by one for Understanding the Architecture of the .NET Framework.
Layer 1 (Language Specific Compilers)
The first layer of .NET architecture comprises language-specific compilers. In general, the framework supports a number of different programming languages. Basically, this is the layer that a programmer works with and other lower-level layers provide various kinds of functionalities to this layers. Therefore, this layer of the framework allows the programmers to write application source code which gets compiled into an intermediate code called MSIL (Microsoft Intermediate Language) code.
Layer 2 (Common Language Specification)
.NET Framework supports language interoperability. In fact, the source code developed using any of the supported languages is compiled into an intermediate code that follows a common syntax and it allows the code written in any language to be used in another .NET language. Basically, the second layer of the framework contains Common Language Specification that provides a common syntax for all languages that this Framework supports.
Furthermore, if the code is CLS-compliant, other users can refer it for developing different applications in any of the supported languages by the framework. For more information on Common Language Specification (CLS) click here.
Layer 3 (Web Forms and WinForms)
The third layer of .NET Framework comprises of libraries that help us create any kind of application, whether it is a desktop application, web application, or a mobile application. Basically, it is a versatile framework and you can create a desktop application, a website, a mobile application, or a game using it. Also, you can find comprehensive, and mature libraries for creating the application of your choice in .NET.
Basically, the Web Forms library allows you to create a web application or a website using ASP.NET. Whereas, WinForms library allows you to create a desktop GUI application.
Layer 4 (ADO.NET and XML)
Another key point of this framework is that the functionalities for database connectivity are provided by the fourth layer of the architecture. In fact, this layer provides the libraries like ADO.NET. As a matter of fact, using this library, you can create database applications. Basically, the ADO layer provides functionality for connecting a .NET application to a third-party database, whereas, XML provides a portable means for storing data. In fact, there are classes that exist in this framework that creates a database from an XML file or vice-versa. Hence, both ADO and XML are interoperable in .NET.
Layer 5 (Base Class Library)
Base Class Library in .NET provides classes and methods for common applications like IO, graphics, multi-threading, Diagnostics, Reflection, Collections, and so on.
Layer 6 (Common Language Runtime)
Finally, the last layer of the framework represents a runtime system. In other words, the lowermost layer of the architecture interacts directly with the operating system and provides several runtime services. This layer is referred to as Common Language Runtime or CLR.
Basically, the language compilers compile the source code into MSIL code and it is the CLR that converts this MSIL code into the actual machine code that runs on the target hardware. During this process of translating MSIL code into the machine code, the CLR provides several runtime services such as allocating memory to objects, loading classes, handling cross-language exceptions, garbage collection, type checking, code management, and providing code access security.
For more information on .NET Framework, click here.