This will be the first in a series of articles covering Enterprise Application Development using the Microsoft .NET Platform.
In this first article, I'd like to give you an understanding of the fundamentals of the Microsoft .NET Framework.
This will lay groundwork for upcoming sessions covering object-orientation (OO), software design patterns, service-orientation or Service Oriented Architecture (SOA), Microsoft BizTalk, Visual Studio, Team Foundation Server and other related Microsoft tools and best practices that enable development of distributed applications.
What is the .NET Framework?
The .NET Framework is Microsoft's programming model for building applications on clients, servers, and mobile or embedded devices.
- The .NET Framework consists of 2 main components:
- Common Language Runtime (CLR)
- Base Class Libraries (BCL)
- Manages much of the plumbing involved in developing software, enabling developers to focus on the core business logic code
- Supports over 40 different programming languages
Goals of the .NET Framework
- Minimize software deployment and versioning conflicts
- Guarantee safe execution of code, including code created by an unknown or semi-trusted third party
- Eliminate the performance problems of scripted or interpreted environments
- Provide consistent developer experience across widely varying types of applications, such as desktop applications and Web-based applications
- Build all communication on industry standards to ensure that code based on the .NET Framework can integrate with any other code
- Encourage consistent object-oriented programming environment whether object code is local, distributed, or executed remotely
.NET Architecture Part 1.1 - Common Language Runtime
The Common Language Runtime consists of four major components.
- Common Type System (CTS)
- Defines how types are declared, used and managed in the runtime
- Common Language Specification (CLS)
- A set of base rules to which any language should conform in order to interoperate with other .NET languages
- Metadata
- Embedded data structures that describes the classes and class members that are defined in within each assembly
- Virtual Execution System
- Gives an environment in which code can be executed handling state, control flow and exception management
CLR Infrastructure

Assemblies
- Once compiled, the MSIL code resides within Assemblies
- These can be class libraries (DLLs), executables (EXEs), etc
- Assemblies are stored in the Portable Executable (PE) format
- Of the multiple files stored within each assembly, a Manifest must be included
- The manifest contains the metadata for the assembly
Assembly Names
- Assemblies have a full name that is different than the filename itself
- This full name includes:
- Simple name
- Version number
- Culture
- Public Key token
- Generated upon compilation
- A private key can also be specified for strong naming of the assembly
- Strong names are required when adding assemblies to the Global Assembly Cache (GAC)
Just-In-Time (JIT) Compilation
- At run time, the CLR uses JIT compilation to compile MSIL to native machine code for the current platform
- Compiles only methods that are called, the first time they are called
- Compiled methods are cached for subsequent uses
- Type Safety Verification verifies:
- References to types are strictly compatible with each type being referenced
- Only appropriately defined operations are invoked on each object
- Identities are what they claim to be
.NET Security - CAS
- The security model supported by the CLR is called Code Access Security (CAS)
- Permissions are granted to assemblies based on the identity of the code, or evidence
- Evidence may represent the source of the assembly. (i.e. local, intranet, internet)
- Resources protected by CAS require all callers in the stack to have the corresponding resource permission. (Assembly Level)
- Demanding permissions of all callers at run time affects performance, but protects code from attacks from less-trusted code.
- .NET uses AppDomains for isolating code running in a process.
.NET Security - AppDomains
- AppDomains help provide isolation, unloading and security boundaries for executing managed code
- Increase fault tolerance of the application
- Multiple AppDomains can run in a single process, each having different security privileges
- It’s important to note that several threads can belong to a single AppDomain
- While a thread is not confined to a single AppDomain, at any given time, a thread executes in a single AppDomain
- A process known as “Marshalling” enables access across application domain boundaries
Garbage Collection
- The CLR manages a pool of memory called the managed heap
- Once there are no references to an object, it becomes “garbage” and can no longer be reached
- .NET continuously runs a Garbage Collector (GC) on a separate thread to look for this garbage
- The GC works as a mark and sweep collector, only running when a certain amount of memory has been used, or when the system needs memory
- The GC uses generation marking for each sweep
- Objects marked higher than generation 2 are collected much less frequently
.NET Architecture Part 1.2 - Base Class Libraries
- The .NET Framework Class Library is a collection of reusable types that tightly integrate with the CLR
- Provides an object-oriented type system from which your own code can derive functionality
- Allows for seamless integration of third-party components for specialized development scenarios
Namespaces
- .NET Classes are structured within a hierarchal system called namespaces
- The root namespace is called System
- Class libraries of the .NET Framework are distributed within relative namespaces
- For example:
- System.Console
- WriteLine method for console applications
- System.Xml
- XmlDocument class representing an XML document
Supporting Variety
- Supports range of common tasks such as:
- String management
- Data collection & Database access
- File access, etc
- Windows Presentation Foundation (WPF)
- Visually stunning user experiences
- Windows Communication Foundation (WCF)
- Fast & flexible communications among applications across your enterprise
- ASP.NET
- High-performance and interactive web-based applications
Windows Forms
System.Windows.Forms
- Windows-based applications that take full advantage of the rich user interface features available in the Windows operating system
- Purely object-oriented evolution of MFC and Visual Basic forms
- Fully extendible set of controls and components
- Seamless data binding, error handling, authentication and authorization
ASP.NET
System.Web
- Successor of Microsoft’s Active Server Pages (ASP) technology
- Object-oriented and compiled vs. Interpreted environment
- Built-in authentication, authorization, caching, logging and tracing
- Configuration files enable run time configuration changes
- Event-driven paradigm rather than conventional scripting environments like ASP or PHP
- Support for richer user experiences utilizing AJAX and Silverlight extensions
ADO.NET
System.Data
- ActiveX Data Objects (ADO) for .NET contains a vast library for accessing data from underlying data stores
- Supports various .NET Data Providers
- System.Data.SqlClient
- System.Data.OracleClient
- System.Data.Odbc
- System.Data.OleDb
- System.Data.DataSet
- Explicitly designed for data access independent of any data source
Data Providers & Datasets

.NET Framework Stack

Resources
- What is .NET?
- Success Stories
- .NET Framework Developer Center
- Training Resources
- Visual Studio Trials & Express Editions