Você está na página 1de 6

Internet Application Programming

1.1

.NET Architecture: .NET is a collection of tools, technologies, and languages that all work together in a framework to provide the solutions that are needed to easily build and deploy truly robust enterprise applications. These .NET applications are also able to easily communicate with one another and provide information and application logic, regardless of platforms and languages. Figure 1-1 shows an overview of the structure of the .NET Framework.

Visual Basic

Visual C#

Visual J#

C++

FORTRAN

Common Language Specification

.NET APPLICATIONS Windows Form Web Applications Web Services

Base Class Libraries

Common Language Runtime

Operating System
Figure 1.1 .NET Framework Architecture

Prepared By: G R Shah Chandresh Patel

In the above

Internet Application Programming architecture of .NET the Framework sits on top of

the operating

system. Presently, the operating systems that can take the .NET Framework include Windows XP, Windows 2000, and Windows NT and Window Vista. CLR: At the base of the .NET Framework is the Common Language Runtime (CLR). The CLR is the heart of .NET Framework. It is the engine that manages the execution of the code. Base Class Library: The next layer up in the .NET Framework is Base Class Library. This layer contains classes, value types, and interfaces that you will use often in your development process. Most notably within the .NET Framework Base Classes is ADO.NET, which provides access to and management of data. .NET Applications: The next layer up in the .NET Framework is ASP.NET applications that includes: (1) Window Form: Allows you to develop GUI based window application. (2) Web Application: Allows you to develop websites that can be accessed online all over the world. (3) Web Services: Allows you to develop web services that can accessed on internet. CLS: The next layer up in the .NET Framework is common language specification. If you want the code which you write in a language to be used by programs in other languages then it should meet all the features that described in the CLS. The CLS describes a set of features that different languages have in common. The CLS defines the minimum standards that .NET language compilers must conform to, and ensures that any source code compiled by a .NET compiler can interoperate with the .NET Framework. .NET Languages: The last layer of the .NET framework is the languages that supported by the .NET which are Visual basic, Visual C#, Visual J#, Fortran Visual C++ etc. 1.2 Namespace: The .NET Framework is made up of hundreds of classes. Many of the applications that we build in .NET are going to take advantage of these classes in one way or another way. Because the number of classes is so large and we need to get them in a logical fashion, the .NET Framework organizes these classes into a hierarchical class structure called a namespace. Namespaces are the way to organize .NET Framework Class Library into a logical grouping according to their functionality, usability as well as category they should

Prepared By: G R Shah Chandresh Patel

Internet Application Programming belong to. We can say Namespaces are logical grouping of types for the purpose
of identification. The .NET Framework Class Library (FCL) is a large collection of thousands of Classes. These Classes are organized in a hierarchical tree. The System Namespaces is the root for types in the .NET Framework. We can uniquely identify any Class in the .NET Framework Class Library (FCL) by using the full Namespaces of the class .In .Net languages every program is created with a default Namespaces . Programmers can also create their own Namespaces in .Net languages. There are a number of namespaces, and they are organized in an understandable and straightforward way. System is the Base namespace in the .NET framework all the namespace are derived from the system namespace. If we want to import particular namespace in our application then we have to write the following code at the top of our application as follow: Visual C# using System. Data; Namespace System System.Collections System.Diagnostics System.Drawing Purpose of Types All the basic types used by every application. Managing collections of objects. Includes the popular collection types such as Stacks, Queues, Hashtables, and so on. Instrumenting and debugging your application. Manipulating 2D graphics. Typically used for Windows Forms applications and for creating images that are to appear in a web form. Managing transactions, queued components, object pooling, just-in-time activation, security, and other features to make the use of managed code more efficient on the server. National Language Support (NLS), such as string compares, formatting, and calendars. Doing stream I/O, walking directories and files. Managing other computers in the enterprise via WMI. Network communications. 3

System.EnterpriseServices

System.Globalization System.IO System.Management System.Net Prepared By: G R Shah Chandresh Patel

Internet Application Programming


System.Reflection System.Resources System.Runtime.InteropServices System.Runtime.Remoting System.Runtime.Serialization System.Security System.Text System.Threading System.Xml 1.3 Inspecting metadata and late binding to types and their members. Manipulating external data resources. Enabling managed code to access unmanaged OS platform facilities, such as COM components and functions in Win32 DLLs. Accessing types remotely. Enabling instances of objects to be persisted and regenerated from a stream. Protecting data and resources. Working with text in different encodings, like ASCII or Unicode. Performing asynchronous operations and

synchronizing access to resources. Processing XML schemas and data.

Managed Code Vs Unmanaged Code: Managed Code in Microsoft .Net Framework, is the code that is executed by the Common Language Runtime (CLR) environment. On the other hand Unmanaged Code is directly executed by the computer's CPU. Data types, error-handling mechanisms, creation and destruction rules, and design guidelines vary between managed and unmanaged object models. The benefits of Managed Code include programmers convenience and enhanced security. Managed code is designed to be more reliable and robust than unmanaged code, examples are Garbage Collection, Type Safety etc. The Managed Code running in a Common Language Runtime (CLR) cannot be accessed outside the runtime environment as well as cannot call directly from outside the runtime environment. This makes the programs more isolated and at the same time computers are more secure. Unmanaged Code can bypass the .NET Framework and make direct calls to the Operating System. Calling unmanaged code presents a major security risk.

1.4

Assemblies Assemblies are the building blocks of .NET Framework applications they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions.

Prepared By: G R Shah Chandresh Patel

Internet Application Programming An assembly is a collection of types and resources that are built to work together
and form a logical unit of functionality. needs to be aware of type implementations. To the runtime, a type does not exist outside the context of an assembly.

An assembly provides the common language runtime with the information it

Assemblies are a fundamental part of programming with the .NET Framework. An assembly performs the following functions: It contains code that the common language runtime executes. Microsoft intermediate language (MSIL) code in a portable executable (PE) file will not be executed if it does not have an associated assembly manifest. It forms a security boundary. An assembly is the unit at which permissions are requested and granted.

It forms a type boundary. Every type's identity includes the name of the assembly in which it resides. A type called MyType loaded in the scope of one assembly is not the same as a type called MyType loaded in the scope of another assembly.

1.7 MSIL: When we compile our .Net Program using any .Net compliant language (like C#, VB.Net, C++.Net) it does not get converted directly into the executable binary code but to an intermediate code, which is known as Microsoft Intermediate Language (MSIL) which is understand by CLR. MSIL is OS and hardware independent code. When the program needs to be executed, this MSIL, or intermediate code, is converted to binary executable code (native code). The presence of MSIL makes possible the Cross Language Relationship as all the .Net compliant languages produce similar, standard MSIL code.

1.9

JIT:

Prepared By: G R Shah Chandresh Patel

When our MSIL

Internet Application Programming compiled code needs to be executed, CLR invokes

the JIT

compilers which compile the MSIL code into native executable code (.exe or .dll) that is designed for the specific machine and OS. JIT differ from traditional compilers as they compile the MSIL to native code only when desired; e.g., when a function is called, the MSIL of the function's body is converted to native code just in time. So, the part of code that is not used by that particular run is never converted to native code. If some IL code is converted to native code, then the next time it's needed, the CLR reuses the same (already compiled) copy without re-compiling. So, if a program runs for sometime (assuming that all or most of the functions get called), then it won't have any just-in-time performance penalty. As JIT are aware of the specific processor and OS at runtime, they can optimize the code extremely efficiently resulting in very robust applications.

Prepared By: G R Shah Chandresh Patel

Você também pode gostar