.NET FRAMEWORK

The .NET Framework is a common environment for building, deploying, and running Web Services and Web Applications.

 The .NET Framework contains common class libraries - like ADO.NET, ASP.NET and Windows Forms - to provide advanced standard services that can be integrated into a variety of computer systems.

 The .NET Framework is language neutral. Currently it supports C++, C#, Visual Basic, JScript (The Microsoft version of JavaScript) and COBOL. Third-party languages - like Eiffel, Perl, Python, Smalltalk, and others - will also be available for building future .NET Framework applications. 

 The new Visual Studio.NET is a common development environment for the new .NET Framework. It provides a feature-rich application execution environment, simplified development and easy integration between a number of different development languages.

.NET Framework



Languages Supported By .NET

Languages Supported By .NET



Common Type System and CLS

CLS(Common Language Specification) Compliant Attribute
  • A subset of Common Type System
  • Assembly can be tagged with[assembly: System.CLSCompliant(true)] Compiler issues a warning if non compliant types are used.
  • Solves the cross language access problem in COM (e.g C++ has types that is not supported by VB)
  • (Private) types, methods may still be marked with [CLSCompliant(false)]
CTS



ASP.NET and Web Forms

ASP.NET and Web Forms



Windows Forms

  • Components needed to create windows applications
  • WIN32 at last hidden with real OOP!
  • Visual Inheritance
  • Same controls used from all languages
  • Consistent naming of properties, methods and behaviour!!!!
  • Forms + Listboxes, Buttons etc
  • WIN32 specific
    • Builds pretty much on intrinsic WIN32 functionality
    • Makes it difficult to support.



Database Support in .NET

  • Create your database
  • Use Visual Studio to create Datalink and typed dataset out of your database.
  • open OleDbConnection
  • OleDbDataAdapter for SQL command
  • Use the adapter to fill out your custom dataset with the requested information
  • Modify your dataset
  • Create update command with the OleDbCommandBuilder
  • Update the database with the adapter (given your dataset)
Database Support in .NET


XML Support

  • XML Is used everywhere
  • Store / Retrieve Datasets in XML
  • XMLTextReader, XMLTextWriter
  • XMLDataDocument
    • W3C Document Object Model (DOM)
  • XMLNode
  • XPath, XslTransform
  • XMLSerialization
  • . . .



Base Class Library

The Base Class Libraries (BCL) provides the fundamental building blocks for any application you develop, be it an ASP.Net application , a Windows Forms application, or a Web Service. The BCL generally serves as your main point of interaction with the runtime.BCL classes include
Base Class Library Namespaces
Namespace Description
System
This namespace includes all the essential support you need for your programming, including base types (String, Int32, DateTime, Boolean, etc.), essential environmental support, and math functions, to name a few
System.CodeDom
all the support necessary to be able to create code, and run it, on the fly
System.Collections
The System.Collections namespace contains interfaces and classes that define various containers, such as lists, queues, bit arrays, hashtables and dictionaries.
System.Diagnostics
All the classes you need to diagnose your application, including event logging, performance counters, tracing, and process management APIs.
System.Globalization
This namespace includes fundamental support for Globalization, used throughout the rest of the Framework
System.IO
Includes fundamental Stream support which can be used by anyone, and then specifically targets the FileSystem (via File and Directory manipulation classes), SerialPorts, and Decompression
System.Resources
Used to allow an application to be translated into multiple languages, and then display the appropriate text based upon the current users language selection
System.Text
This namespace includes support for encodings, and Stringbuilder
System.Text.RegularExpressions
This namespace includes regular expression support, for robust parsing and matching of string data



Common Language Runtime

The Common Language Runtime (CLR) provides a solid foundation for developers to build various types of applications. Whether you're writing an ASP.Net application , a Windows Forms application, a Web Service, a mobile code application, a distributed application, or an application that combines several of these application models, the CLR provides the following benefits for application developers:
  • Vastly simplified development
  • Seamless integration of code written in various languages
  • Evidence-based security with code identity
  • Assembly-based deployment that eliminates DLL Hell
  • Side-by-side versioning of reusable components
  • Code reuse through implementation inheritance
  • Automatic object lifetime management
  • Self describing objects
Common Language Runtime
Common Language Runtime(simplified)
The CLR is the execution environment provided by the Microsoft .NET Framework. It provides many services such as
  • Automatic garbage collection
  • Code access security
  • Simplified versioning
  • Simple and reliable deployment
  • Deep cross-language interoperability
  • Debugging across different languages
  • Performance
  • Scalability
Because the CLR manages the code execution, all the code that is targeted for the CLR is known as managed code. Managed code emits metadata along with the executable. This metadata is used to describe the types (classes) and members used in the code, along with all the external references used in executing the code. The CLR uses this metadata to load the classes during execution and resolve method invocations during runtime.
The CLR provides automatic garbage collection of the objects that have been loaded into memory. All objects that are created via the new operator are allocated memory on the heap. A program can allocate as many objects as are required by the program logic. However, when an object is no longer required, there must be some mechanism to free up the memory that was occupied by the object.
This is accomplished in the CLR via a program called garbage collector, which collects all objects in memory that have no references. This program runs as a low-priority thread in the background process and collects all unreferenced objects. Because memory management is automatic, the chances for memory leaks in the program are minimized. However, the time when garbage collector would actually release the objects from the memory is not known. This concept is known as nondeterministic garbage collection because it cannot be determined in advance when the objects would be released from memory.
If sufficient memory is not available for creating new objects, the CLR throws an exception that can be caught and gracefully handled by the application.
Code Access Security (CAS), as the name suggests, is used to control the access that the code has to system resources. The CLR has a runtime security system. Administrators can configure policy settings by specifying the resources that can be accessed by the code.
A call stack is created that represents the order in which the assemblies get called. The CLR's security system walks the stack to determine whether the code is authorized to access the system resources or perform certain operations. If any caller in the call stack does not have the requisite permission to access the specific system resources, a security exception is thrown by the CLR.
Simplified versioning is another feature provided in the .NET Framework. It supports versioning and also provides for side-by-side execution of different versions of the same component. The specific versions of the assembly and the dependent assemblies are stored in the assembly's manifest. The copies of the same assembly that differ only in version numbers are considered to be different assemblies by the CLR.
Simplified deployment is one of the features provided in the .NET Framework. The most important point to mention is that .NET components do not need to be registered in the Windows registry. All code generated in the .NET Framework is self-describing because assemblies contain the manifest and metadata information. This information contains all the data about the dependencies of the assembly and the specific versions of the components that these assemblies would use at execution time; therefore, multiple versions of the same components can coexist. The CLR enforces the versioning policy.
Cross-language interoperability is an important feature, and it was one of the design goals of the .NET Framework. This feature is possible because of the CTS and CLS.
Visual Studio .NET allows for debugging across an application consisting of different languages targeted for the CLR. In fact, the IDE also allows for debugging an application in which managed code interacts with unmanaged code.
CLR ensures that performance of the code execution is optimized. Compiled code is stored in cache. When the same code is called next time, this code is loaded into memory from cache. This advantage stands out more in the case of ASP.NET applications than for ASP applications. ASP code was interpreted every time an ASP page was requested. In ASP.NET, the code is compiled only once when the page is requested for the first time. This ensures that performance is optimized.
The .NET Framework also provides some classes for tracking the performance of the .NET applications. These classes are known as performance counters. The .NET Framework provides performance counters for getting information on exception handling, interoperation with unmanaged code, loading and unloading code into memory, locking and threading, memory, networking operations, and so on. These performance counters help to fine-tune the performance of the .NET applications.



COM+ Services

Evolution of COM