Thursday, December 11, 2008

Thursday, October 30, 2008

.Net Application

The Microsoft .NET Framework
The .NET Framework is Microsoft's managed code programming model for building applications on Web, Windows clients, servers, and mobile or embedded devices. Developers use .NET to build applications of many types: Web applications, server applications, smart client applications, console applications, database applications, and more. The .NET Framework is the infrastructure for the Microsoft .NET platform. The .NET Framework is an environment for building, deploying, and running Web applications and Web Services. Microsoft's first server technology ASP (Active Server Pages), was a powerful and flexible "programming language". But it was too code oriented. It was not an application framework and not an enterprise development tool. The Microsoft .NET Framework was developed to solve this problem. .NET Frameworks keywords: -> Easier and quicker programming -> Reduced amount of code -> Declarative programming model -> Richer server control hierarchy with events -> Larger class library -> Better support for development tools
The .NET Framework consists of 3 main parts:
1.Programming languages:
-> C# (Pronounced C sharp)
-> Visual Basic (VB .NET)
-> J# (Pronounced J sharp)
-> Visual C++
->Many other Custom made Languges are avilable to support .net framework (FORTRAN, COBOL etc.)

2.Server technologies and client technologies:
-> ASP .NET (Active Server Pages)
-> Windows Forms (Windows desktop solutions)
-> Compact Framework (PDA / Mobile solutions)

3.Development environments:
-> Visual Studio .NET (VS .NET)
-> Visual Web Developer

To support this variety, the .NET Framework includes a broad set of supporting class libraries, including:
Windows Presentation Foundation (WPF), for visually stunning user experiences on Windows clients;
Windows Communication Foundation (WCF), enabling fast and flexible communications among applications across your enterprise;
Windows Workflow Foundation (WF), allowing developers to build workflows into any application;
ASP.NET, for high-performance and interactive Web-based applications;
Libraries for handling XML, data, IO, cryptography, text-to-speech, and more.
To develop these Applications we are using Powerful Languages C#.Net, VB.Net, J#, Vicual C++ etc. Almost every Application have the three layered Architucture as fallows
1.Presentaion Layer
2.Business Logic Layer and
3.Data Access Layer.

We will see brief about these layers
Presentation Layer: Presentation Layer is the Interface between both user and the system. Most simple presentation layers contain user interface components, such as Microsoft® Windows Forms or ASP.NET Web Forms. These components typically contain code to perform functions such as configuring the visual appearance of controls; accepting and validating user input; and acquiring and rendering data from data access logic components or business components. The presentation layer can also include user interface process components. User interface process components perform presentation layer tasks that are not directly concerned with user interactions. For example, user interface process components orchestrate the flow of control between forms in the presentation layer and coordinate background tasks such as state management and handling of concurrent user activities.

Business Logic Layer: Business Logic Layer is the interface between Presentation layer and the Data Access layer. This Business logic layer is usually one of the tiers in a multitier architecture. It separates the business logic from other modules, such as the Data access layer and Presentation Layer User interface. The business logic of an application can often withstand modifications or replacements of other tiers. For example, in an application with a properly separated Business logic layer and Data access layer, the Data access layer could be rewritten to retrieve data from a different database, without affecting any of the business logic. This practice allows software application development to be more effectively split into teams, with each team working on a different tier simultaneously. Within a Business Logic Layer objects can further be partitioned into Business Processes (aka Business Activities) and Business Entities. Business Process objects typically implement the Controller Pattern, ie: they contain no data elements but have methods that orchestrate interaction among Business Entities. Business Entities typically correspond to entities in the logical domain model (rather than the physical database model).

Data Access Layer:Data Access Layer is to provide data to your business objects without using database specific code. You accomplish this by exposing a series of data access methods from the Data Access Layer that operate on data in the data-tier using database specific code but do not expose any database specific method parameters or return types to the business tier. Any time a business object needs to access the data tier, you use the method calls in the DAL instead of calling directly down to the data tier. This pushes database-specific code into the DAL and makes your business object database independent.

Friday, March 28, 2008

Microsoft .NET Framework

Microsoft .NET Framework is a software component that is a part of Microsoft Windows operating systems. It has a large library of pre-coded solutions to common program requirements, and manages the execution of programs written specifically for the framework. The .NET Framework is a key Microsoft offering, and is intended to be used by most new applications created for the Windows platform.
The pre-coded solutions that form the framework's Base Class Library cover a large range of programming needs in areas including: user interface, data access, database connectivity, cryptography, web application development, numeric algorithms, and network communications. The class library is used by programmers who combine it with their own code to produce applications.
Programs written for the .NET Framework execute in a software environment that manages the program's runtime requirements. This runtime environment, which is also a part of the .NET Framework, is known as the Common Language Runtime (CLR). The CLR provides the appearance of an application virtual machine, so that programmers need not consider the capabilities of the specific CPU that will execute the program. The CLR also provides other important services such as security mechanisms, memory management, and exception handling. The class library and the CLR together compose the .NET Framework.

The .NET Framework is included with Windows Server 2003, Windows Server 2008 and Windows Vista, and can be installed on some older versions of Windows.

Principal Design Features
Interoperability: Because interaction between new and older applications is commonly required, the .NET Framework provides means to access functionality that is implemented in programs that execute outside the .NET environment. Access to COM components is provided in the System.Runtime.InteropServices and System.EnterpriseServices namespaces of the framework, and access to other functionality is provided using the P/Invoke feature.

Common Runtime Engine: Programming languages on the .NET Framework compile into an intermediate language known as the Common Intermediate Language, or CIL (formerly known as Microsoft Intermediate Language, or MSIL). In Microsoft's implementation, this intermediate language is not interpreted, but rather compiled in a manner known as just-in-time compilation (JIT) into native code. The combination of these concepts is called the Common Language Infrastructure (CLI), a specification; Microsoft's implementation of the CLI is known as the Common Language Runtime (CLR).

Language Independence:The .NET Framework introduces a Common Type System, or CTS. The CTS specification defines all possible datatypes and programming constructs supported by the CLR and how they may or may not interact with each other. Because of this feature, the .NET Framework supports the exchange of instances of types between programs written in any of the .NET languages. This is discussed in more detail in Microsoft .NET Languages.

Base Class Library:The Base Class Library (BCL), part of the Framework Class Library (FCL), is a library of functionality available to all languages using the .NET Framework. The BCL provides classes which encapsulate a number of common functions, including file reading and writing, graphic rendering, database interaction and XML document manipulation.

Simplified Deployment:Installation of computer software must be carefully managed to ensure that it does not interfere with previously installed software, and that it conforms to increasingly stringent security requirements. The .NET framework includes design features and tools that help address these requirements.

Security:The design is meant to address some of the vulnerabilities, such as buffer overflows, that have been exploited by malicious software. Additionally, .NET provides a common security model for all applications.

Portability:The design of the .NET Framework allows for it to be platform agnostic, and thus be cross platform compatible. That is, a program written to use the framework should run without change on any type of system for which the framework is implemented. Microsoft's commercial implementations of the framework cover Windows, Windows CE, and the Xbox 360. In addition, Microsoft submits the specifications for the Common Language Infrastructure (which includes the core class libraries, Common Type System, and the Common Intermediate Language), and the C# language, and the C++/CLI language to both ECMA and the ISO, making them available as open standards. This makes it possible for third parties to create compatible implementations of the framework and its languages on other platforms.

Architecture
CLI (Common Language Infrastructure)
The core aspects of the .NET framework lie within the Common Language Infrastructure, or CLI. The purpose of the CLI is to provide a language-agnostic platform for application development and execution, including functions for exception handling, garbage collection, security, and interoperability. Microsoft's implementation of the CLI is called the Common Language Runtime, or CLR. The CLR is composed of four primary parts:
Common Type System (CTS)
Common Language Specification (CLS)
Metadata
Virtual Execution System (VES)

Assemblies (.NET assembly):The intermediate CIL code is housed in .NET assemblies. As mandated by specification, assemblies are stored in the Portable Executable (PE) format, common on the Windows platform for all DLL and EXE files. The assembly consists of one or more files, but one of these must contain the manifest, which has the metadata for the assembly. The complete name of an assembly (not to be confused with the filename on disk) contains its simple text name, version number, culture and public key token. The public key token is a unique hash generated when the assembly is compiled; thus two assemblies with the same public key token are guaranteed to be identical. A private key can also be specified known only to the creator of the assembly and can be used for strong naming and to guarantee that the assembly is from the same author when a new version of the assembly is compiled (required to add an assembly to the Global Assembly Cache).

Metadata: .NET metadata,All CIL is Self-Describing through .NET metadata. The CLR checks on metadata to ensure that the correct method is called. Metadata is usually generated by language compilers but developers can create their own metadata through custom attributes. Metadata also contains information about the assembly. Metadata is also used to implement the reflective programming capabilities of .NET Framework.

Base Class library: Base Class Library, sometimes incorrectly referred to as the Framework Class Library (FCL) (which is a superset including the Microsoft.* namespaces), is a library of classes available to all languages using the .NET Framework. The BCL provides classes which encapsulate a number of common functions such as file reading and writing, graphic rendering, database interaction, XML document manipulation, and so forth. The BCL is much larger than other libraries, but has much more functionality in one package.

Security: .NET has its own security mechanism, with two general features: Code Access Security (CAS), and validation and verification. Code Access Security is based on evidence that is associated with a specific assembly. Typically the evidence is the source of the assembly (whether it is installed on the local machine, or has been downloaded from the intranet or Internet). Code Access Security uses evidence to determine the permissions granted to the code. Other code can demand that calling code is granted a specified permission. The demand causes the CLR to perform a call stack walk: every assembly of each method in the call stack is checked for the required permission and if any assembly is not granted the permission then a security exception is thrown. When an assembly is loaded the CLR performs various tests. Two such tests are validation and verification. During validation the CLR checks that the assembly contains valid metadata and CIL, and it checks that the internal tables are correct. Verification is not so exact. The verification mechanism checks to see if the code does anything that is 'unsafe'. The algorithm used is quite conservative and hence sometimes code that is 'safe' is not verified. Unsafe code will only be executed if the assembly has the 'skip verification' permission, which generally means code that is installed on the local machine.
.NET Framework uses appdomains as a mechanism for isolating code running in a process. Appdomains can be created and code loaded into or unloaded from them independent of other appdomains. This helps increase fault tolerance of the application, as faults or crashes in one appdomain do not affect rest of the application. Appdomains can also be configured independently with different security privileges. This can help increasing security of the application by separating potentially unsafe code. However, the developer has to split the application into subdomains, it is not done by the CLR.

Memory management
The .NET Framework CLR frees the developer from the burden of managing memory (allocating and freeing up when done); instead it does the memory management itself. To this end, the memory allocated to instantiations of .NET types (objects) is done contiguously[8] from the managed heap, a pool of memory managed by the CLR. As long as there exists a reference to an object, which might be either a direct reference to an object or via a graph of objects, the object is considered to be in use by the CLR. When there is no reference to an object, and thus cannot be reached or used, it becomes garbage. However, it still holds on to the memory allocated to it. .NET Framework includes a garbage collector which runs periodically, on a separate thread than the application's thread, that enumerates all the unusable objects and reclaims the memory allocated to them.
The .NET Garbage Collector (GC) is a non-deterministic, compacting, mark-and-sweep garbage collector. The GC runs only when a certain amount of memory has been used or there is enough pressure for memory on the system. Since it is not guaranteed when the conditions to reclaim memory are reached, the GC runs are non-deterministic. Each .NET application has a set of roots , which are a set of pointers maintained by the CLR that point to objects on the managed heap (managed objects). These include references to static objects and objects defined as local variables or method parameters currently in scope, as well as objects referred to by CPU registers. When the GC runs, it pauses the application, and for each objects referred to in the root, it recursively enumerates all the objects reachable from the root objects and marks the objects as reachable. It uses .NET metadata and reflection to discover the objects encapsulated by an object, and then recursively walk them. It then enumerates all the objects on the heap (which were initially allocated contiguously) using reflection and all the objects, not marked as reachable, are garbage. This is the mark phase. Since the memory held by garbage is not of any consequence, it is considered free space. However, this leaves chunks of free space between objects which were initially contiguous. The objects are then compacted together, by using memcpy to copy them over to the free space to make them contiguous again. Any reference to an object invalidated by moving the object is updated to reflect the new location by the GC. The application is resumed after the garbage collection is over.
The GC used by .NET Framework is actually generational. Objects are assigned a generation; newly created objects belong to Generation 0. The objects that survive a garbage collection are tagged as Generation 1, and the Generation 1 objects that survive another collection are Generation 2 objects. The .NET Framework uses up to Generation 2 objects. Higher generation objects are garbage collected less frequently than lower generation objects. This helps increase the efficiency of garbage collection, as older objects tend to have a larger lifetime than newer objects. Thus, by removing older (and thus more likely to survive a collection) objects from the scope of a collection run, fewer objects need to be checked and compacted.

Different versions of .Net Framework with Release Dates
Version -Version Number -Release Date
1.0 - 1.0.3705.0 - 2002-01-05
1.1 - 1.1.4322.573 - 2003-04-01
2.0 - 2.0.50727.42 - 2005-11-07
3.0 - 3.0.4506.30 - 2006-11-06
3.5 - 3.5.21022.8 - 2007-11-19

A more complete listing of the releases of the .NET Framework may be found on the .NET Framework version list.

.NET Framework 1.0
This is the first release of the .NET Framework. Released on February 13, 2002. Available for Windows 98, NT 4.0, 2000, and XP.

.NET Framework 1.1
This is the first major .NET Framework upgrade. It is available on its own as a redistributable package or in a software development kit, and was published on April 3, 2003. It is also part of the second release of Microsoft Visual Studio .NET (released as Visual Studio .NET 2003). This is the first version of the .NET Framework to be included as part of the Windows operating system, shipping with Windows Server 2003.
Changes since 1.0
Built-in support for mobile ASP.NET controls. Previously available as an add-on for .NET Framework, now part of the framework.
Security changes - enable Windows Forms assemblies to execute in a semi-trusted manner from the Internet, and enable Code Access Security in ASP.NET applications.
Built-in support for ODBC and Oracle databases. Previously available as an add-on for .NET Framework 1.0, now part of the framework.
.NET Compact Framework - a version of the .NET Framework for small devices.
Internet Protocol version 6 (IPv6) support.
Numerous API changes.

.NET Framework 2.0
Released with Visual Studio 2005, Microsoft SQL Server 2005, and BizTalk 2006.
The 2.0 Redistributable Package can be downloaded for free from Microsoft, and was published on 2006-01-22.
The 2.0 Software Development Kit (SDK) can be downloaded for free from Microsoft.
It is included as part of Visual Studio 2005 and Microsoft SQL Server 2005.
Version 2.0 is the last version with support for Windows 2000, Windows 98 and Windows Me.
It shipped with Windows Server 2003 R2 (not installed by default).

Changes since 1.1
Numerous API changes.
A new hosting API for native applications wishing to host an instance of the .NET runtime. The new API gives a fine grain control on the behavior of the runtime with regards to multithreading, memory allocation, assembly loading and more (detailed reference). It was initially developed to efficiently host the runtime in Microsoft SQL Server, which implements its own scheduler and memory manager.
Full 64-bit support for both the x64 and the IA64 hardware platforms.
Language support for Generics built directly into the .NET CLR.
Many additional and improved ASP.NET web controls.
New data controls with declarative data binding.
New personalization features for ASP.NET, such as support for themes, skins and webparts.
.NET Micro Framework - a version of the .NET Framework related to the Smart Personal Objects Technology initiative.

.NET Framework 3.0
.NET Framework 3.0, formerly called WinFX, includes a new set of managed code APIs that are an integral part of Windows Vista and Windows Server 2008 operating systems. It is also available for Windows XP SP2 and Windows Server 2003 as a download. There are no major architectural changes included with this release; .NET Framework 3.0 uses the Common Language Runtime of .NET Framework 2.0. Unlike the previous major .NET releases, there was no .NET Compact Framework release made as a counterpart of this version.
.NET Framework 3.0 consists of four major new components:
Windows Presentation Foundation (WPF), formerly code-named Avalon; a new user interface subsystem and API based on XML and vector graphics, which uses 3D computer graphics hardware and Direct3D technologies. See WPF SDK for developer articles and documentation on WPF.
Windows Communication Foundation (WCF), formerly code-named Indigo; a service-oriented messaging system which allows programs to interoperate locally or remotely similar to web services.
Windows Workflow Foundation (WF) allows for building of task automation and integrated transactions using workflows.
Windows CardSpace, formerly code-named InfoCard; a software component which securely stores a person's digital identities and provides a unified interface for choosing the identity for a particular transaction, such as logging in to a website.

.NET Framework 3.5
Version 3.5 of the .NET Framework was officially released to manufacturing (RTM) on November 19, 2007. As with .NET Framework 3.0, version 3.5 uses the CLR of version 2.0. In addition, it installs .NET Framework 2.0 SP1, which adds some methods and properties to the BCL classes in version 2.0 which are required for version 3.5 features such as Language Integrated Query (LINQ). These changes do not affect applications written for version 2.0, however. As with previous versions, a new .NET Compact Framework 3.5 was released in tandem with this update in order to provide support for additional features on Windows Mobile and Windows Embedded CE devices.
The source code of the Base Class Library in this version has been partially released under Microsoft Reference License
Summary of changes in version 3.5
-> New language features in C# 3.0 and VB.NET 9.0 compiler
-> Adds support for expression trees and lambda methods Extension methods
-> Anonymous types with static type inference
-> Language Integrated Query (LINQ) along with its various providers
1. LINQ to Objects
2. LINQ to XML
3. LINQ to SQL
4. Paging support for ADO.NET
-> ADO.NET synchronization API to synchronize local caches and server side datastores
-> Asynchronous network I/O API
-> Peer-to-peer networking stack, including a managed PNRP resolver
-> Managed wrappers for WMI and Active Directory APIs
-> Enhanced WCF and WF runtimes, which let WCF work with POX and JSON data, and also expose WF workflows as WCF services.
-> Support for HTTP pipelining and syndication feeds
-> ASP.NET AJAX is included
-> New System.CodeDom namespace