Net Fundamentals


Published on

1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Net Fundamentals

    1. 1. Net Fundamentals<br />TDG - Injazat<br />What is Dot Net.ppt<br />
    2. 2. Contents<br />NET Framework Core Components<br />Common Language Runtime (CLR)<br />Class Library<br />Next Generation Windows Services (NGWS)<br />Changes Since 1.0 & 1.1<br />Changes Since 2.0 & 3.0<br />.Net 3.5 SP1 (Codename “Arrowhead”)<br />.Net Framework Current “Layer Cake”<br />The Most Important Feature Of .NET 4.0<br />.Net Framework 4.0 <br />Assemblies<br />Garbage Collection<br />Names You Need To Know About<br />What Really Happens<br />Namespaces<br />Tools Provided By The .NET Framework<br />The Common Type System<br />Controlling Access To A Method Or Field<br />Using Value Types<br />Built-in Value Types<br />
    3. 3. NET framework Core components<br />The .NET framework has two major components:<br />Common Language Runtime (CLR) <br />Class Library<br />Net framework works like the Domino Objects only much lower level and very complete<br />It is part of the OS (or can be added)<br />Replaces win32 API calls - mostly<br />Decoupled from OS<br />Supports many programming languages with the CLR (Common Language Runtime)<br />
    4. 4. Terminology &quot;ABC&quot;<br />CLR: Common Language Runtime<br />One runtime for many programming languages<br />Intermediate Language (IL)<br />One intermediate, high-level assembly-style language that is emitted by language compilers<br />Assembly<br />Container for code, metadata and resources – your new term for what you used to call &quot;D-L-L&quot;<br />Metadata<br />Information that describes the shape of data and the runtime behavior of a program<br />
    5. 5. Common Language Runtime (CLR)<br />The CLR is the foundation upon which the .NET Framework has been built. The runtime manages code at execution time and provides all the core services such as memory management, thread management and remoting. It also enforces strict type safety and ensures code accuracy in order to provide security and robustness to the applications. This capability to manage code at runtime is the distinguishing feature of the CLR. All code that is managed by the CLR is known as managed code while other codes are known as unmanaged code.<br />CLR Features<br />1. CLR manages memory, thread execution, code execution, compilation code safety verification and other system services.<br />2. For security reasons, managed code is assigned varying degrees of trust based on origin. This prevents or allows the managed component from performing file access operations, registry access operations or other sensitive functions even within the same active application.<br />3. The Runtime enforces code robustness by implementing strict type and code verification infrastructure called Common type System (CTS). The CTS ensures that all managed code is self describing and all Microsoft or third party language compiler generated codes conform to CTS. This enables the managed code to consume other managed types and enforce strict type fidelity and type safety.<br />4. CLR eliminates many common software issues like handling of object layout, references to objects and garbage clearance. This type of memory management prevents memory leaks and invalid memory references.<br />5. The CLR also accelerates developer productivity. The programmer is free to choose the language of the application without worrying about compatibility and integration issues. He is also enabled to take advantage of the runtime and the class library of the .NET Framework and also harvest components from other applications written in different languages by different developers. This implicitly eases the process of migration.<br />6. Though CLR aims to be futuristic software, it lends support to existing applications. The interoperability between the managed and unmanaged codes makes this process extremely simple. 7. The design of the CLR is geared towards enhancing performance. The Just-in-time (JIT) compiling enables managed code to run in the native machine language of the system executing it. During the process the memory manager removes the possibilities of fragmented memory and increases memory locality-of-reference to enhance performance.<br />8. Finally, server side applications can host runtime. High performance servers like Microsoft SQL Server and Internet Information Services can host this CLR and the infrastructure so provided can be used to write business logic while enjoying the best benefits of enterprise server support.<br />
    6. 6. Class Library<br />The Class Library is an object oriented collection of reusable types. It is comprehensive and the types can be used to develop command line applications or GUI applications such as Web forms or XML Web services. <br />Unmanaged components that load CLR into their processes can be hosted by the .NET Framework to initiate the execution of managed code. This creates a software environment that exploits both the managed and unmanaged codes. The.NET Framework also provides a number of runtime hosts and supports third party runtime hosts<br />Class LibraryFeatures<br />1. The class library is a collection of reusable types that integrate with the CLR.<br />2. It is object oriented and provides types from which user defined types can derive functionality. This makes for ease of use and is time saving.<br />3. Third party components can be integrated seamlessly with classes in the .NET framework.<br />4. It enables a range of common programming tasks such as string management, data collection and file access.<br />5. It supports a variety of specialized development scenarios such as console application development, Windows GUI applications, ASP.NET Applications, XML Web services.<br />
    7. 7. Next Generation Windows Services (NGWS)<br />Microsoft started development on the .NET Framework in the late 1990s originally under the above name. By late 2000 the first beta versions of .NET 1.0 were released.<br />Net 2.0<br />Net 1.1<br />Net 1.0<br />REST<br />LINQ<br />AJAX<br />
    8. 8.
    9. 9. Changes since 1.0 & 1.1<br />Changes since 1.0<br />Built-in support for mobile ASP.NET controls. Previously available as an add-on for .NET Framework, now part of the framework. <br />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. <br />Built-in support for ODBC and Oracle databases. Previously available as an add-on for .NET Framework 1.0, now part of the framework. <br />.NET Compact Framework – a version of the .NET Framework for small devices. <br />Internet Protocol version 6 (IPv6) support. <br />Numerous API changes. <br />Changes since 1.1<br />Numerous API changes. <br />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. <br />Full 64-bit support for both the x64 and the IA64 hardware platforms. <br />Language support for generics built directly into the .NET CLR. <br />Many additional and improved ASP.NET web controls. <br />New data controls with declarative data binding. <br />New personalization features for ASP.NET, such as support for themes, skins and webparts. <br />.NET Micro Framework – a version of the .NET Framework related to the Smart Personal Objects Technology initiative. <br />
    10. 10. Changes since 2.0 & 3.0<br />Changes since 2.0<br />.NET Framework 3.0 consists of four major new components:<br />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. <br />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. <br />Windows Workflow Foundation (WF) allows for building of task automation and integrated transactions using workflows. <br />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. <br />Changes since version 3.0<br />New language features in C# 3.0 and VB.NET 9.0 compiler <br />Adds support for expression trees and lambda methods <br />Extension methods <br />Expression trees to represent high-level source code at runtime. <br />Anonymous types with static type inference <br />Language Integrated Query (LINQ) along with its various providers <br />LINQ to Objects <br />LINQ to XML <br />LINQ to SQL <br />Paging support for ADO.NET <br />ADO.NET synchronization API to synchronize local caches and server side datastores<br />Asynchronous network I/O API <br />Peer-to-peer networking stack, including a managed PNRP resolver <br />Managed wrappers for WMI and Active Directory APIs <br />Enhanced WCF and WF runtimes, which let WCF work with POX and JSON data, and also expose WF workflows as WCF services. WCF services can be made stateful using the WF persistence model. <br />Support for HTTP pipelining and syndication feeds. <br />ASP.NET AJAX is included <br />New System.CodeDom namespace. <br />
    11. 11. .Net 3.5 SP1 (codename “Arrowhead”)<br />will reportedly enhance support for occasionally connected applications, and provide built-in support for the Microsoft ASP.NET Model-View-Controller (MVC) Framework. <br />“Arrowhead” will increase the cold-start performance (startup when no other .NET Framework application has been started previously) of .NET Framework applications, by as much as 25 – 40%. <br />It will also hardware accelerate some WPF effects such as shadows, as well as general performance and API enhancements across the WPF stack.<br />In addition, a set of WPF controls, including a DataGrid will also be included.<br /> ADO.NET Entity Framework has also been added which gives the database based application programmer a ORM (Object Relational Mapping) tool.<br />
    12. 12. .Net Framework Current “Layer Cake”<br />
    13. 13. The Most Important Feature of .NET 4.0 <br />.NET 4.0 is going to include some core changes, particularly in the area of parallel processing that is going to be very important to some people, and will eventually make it into all of our consciousness. <br />.NET 4.0 will also include another chance for Entity Framework, <br />.NET 4.0 will bring Azure and cloud computing to the forefront. <br />.NET 4.0 is likely to offer patterns that will be the most important change in my coding since the huge changes brought on by LINQ (and supporting techniques like extensions and lambdas) of .NET 3.5. <br />The most important feature of .NET 4.0 is Windows Workflow 4.0. <br /> (Windows Workflow 4.0 is a complete rewrite of workflow. It&apos;s a brand new product. More than just rewriting, it represents a rethinking of the problem.) <br />And real business value is what its all about<br />
    14. 14. .Net Framework 4.0<br />
    15. 15. COM support: a personal view<br />
    16. 16. Common Language Runtime<br />Base Class Library<br />Core types and services<br />Common Language Runtime<br />Assembly load and execution<br />
    17. 17. Common Language Runtime<br />VB.NET<br />…<br />C#<br />Base Class Libraries<br />Common Type System<br />Security<br />Class Loader, GC, JIT, Execution Support<br />
    18. 18. Common Language Runtime<br />VB.NET<br />IronPython<br />C#<br />Base Class Libraries<br />Dynamic Language Runtime<br />Common Type system<br />Security<br />Class Loader, GC, JIT, Execution Support<br />
    19. 19. Assemblies<br />As in the Windows DNA world where DLLs and EXEs are the building blocks of applications,<br />in the .NET world, it is the assembly that is the used as the foundation of applications.<br />
    20. 20. Garbage collection<br />The .NET Framework is a garbage-collected environment. Garbage collection is the process of detecting when objects are no longer in use and automatically destroying those objects, thus freeing memory.<br />
    21. 21. Names you need to know about<br />The Common Language Infrastructure (CLI)<br /> A subset of the .NET framework is the CLI. The CLI includes the functionality of the Common Language Runtime and specifications for the Common Type System, metadata and Intermediate language. A subset of the Framework Class Library incorporates the base class library, a Network library, a Reflection library, an XML library and Floating point and Extended Array Library. The shared source implementation of the CLI is available for both the FreeBSD and Windows operating Systems.<br />The Common Language Specification (CLS)<br /> The CLR supports the CLS which is a subset of it. Additionally the CLR supports a set of rules that language and compiler designers follow. It provides robust interoperability between the .NET languages and the ability to inherit classes written in one language in any other .NET language. Cross language debugging also becomes a possibility in this scenario. It must be noted that the CLS rules apply only to publicly exposed features of a class.<br />Classes<br /> A blueprint of an object is called a class. All definitions of haw a particular object will be instantiated at runtime, its properties and methods and storage structures are defined in the class. Classes are used by developers for creating instances of the class at runtime using the keyword “New”.<br />Namespaces<br /> This is the key part of the .NET Framework. It provides scope for both preinstalled framework classes and custom developed classes. Vb.NET uses the “Imports” keyword to enable the use of member names from the namespace declared. C# uses the “using” keyword. In both cases the System Namespace is also imported so that the Console window can be written without explicitly referring to the System.Console.<br />Assemblies<br /> Assemblies are also known as managed DLLs. They are the fundamental unit of deployment for the .NET platform. The .NET framework itself is made of a number of assemblies. An assembly contains the Intermediate language generated by the language compiler, an assembly manifest, type metadata and resources. They can be private or public. They are self describing and hence different versions of the same assembly can be run simultaneously.<br />Intermediate language (IL)<br /> This is a processor independent representation of executable code. It is similar to assembly code and specific to the CLR. It is generated by the language compilers that target the CLR. At runtime, the CLR just-in-time compiles the IL to native code for execution. The tool ngen.exe which is part of the .NET framework pre-compiles assemblies to native code at install time and caches the precompiled code to the disk.<br />
    22. 22. Names you need to know about<br />Managed execution<br /> This refers to code whose execution is managed by the CLR. It includes memory management, access security, cross-language integration for debugging and exception handling etc. These assemblies are required for the creation of metadata on the code and the assemblies so that the CLR can manage the execution of the code.<br />Manifests, Metadata and Attributes<br /> Metadata and manifests are key aspects of managed code execution. The portions of an assembly that contains descriptive information about the types contained in the assembly, the members exposed by the assembly and the resources required by the assembly are called manifests. Metadata is contained within the manifest. This metadata describes the assembly and some of it is generated by the language compiler at compile time. Other metadata may be added by the developer at design time. Declarations added to the code to describe or modify some aspect of the code’s behavior at runtime are known as Attributes. These are stored with an assembly as metadata. They serve many useful purposes in the .NET Framework<br />Object Orientation in the .NET Framework<br /> Objects are the core of Object oriented programming. Classes are blueprints of objects and contain all the methods and properties of the object. Encapsulation, inheritance and polymorphism are attributes of an object. Encapsulation means the ability of an object to hide its internal data from outside view and allow access to only that data that is publicly available. Inheritance is the ability to derive one class from another.<br />New classes can be created from existing classes and the new class inherits all the properties and methods of the old class and new methods and events can be added to the new class. This is useful when users want to create specialized classes. Polymorphism is the ability of multiple classes derived from the same base class to expose methods in the same name, regardless of the underlying process of implementation.<br />Rapid Development and Reuse<br /> The object orientation of the .NET Framework provides for faster development and deployment of applications. The use of classes, derived classes to provide common functionality has gone a long way in reducing development time. Object orientation is also the crucial element in the development of the code-behind concept and the latest code beside concept. Code behind allows developers to separate executable code form the HTML markup of the user interface. The executable code is placed in a module called code behind file. This file contains a class that inherits from the Page class. The ASP.NET page inherits from code-behind class and the two are compiled at runtime into a single executable assembly.<br /> The BETA 2.0 has added a number of functionalities to aid in rapid development. We will be looking at these changes in the next unit “What’s new in BETA 2.0”<br />Choosing a Language<br /> An important aspect of the .NET framework is that developers can continue to use the language of their choice in application development. The cross language interoperability in .NET makes it possible to create an application in any .NET supported language as all languages will work together smoothly using the CLR which translates all languages into Intermediary language.<br />
    23. 23. What really happens<br />Intermediate Language (IL) Code<br />This is the code that was produced by the compiler as it compiled the source<br />code. IL is later compiled by the CLR into native CPU instructions.<br />
    24. 24. Namespaces<br />The .NET Framework is made up of hundreds of classes. Many of the applications that you build in .NET are going to take advantage of these classes in one way or another. Because the number of classes is so large and you will need to get at them in a logical fashion, the .NET Framework organizes these classes into a class structure called a namespace. There are a number of namespaces, and they are organized in an understandable and straightforward way.<br />You can import a namespace into your application in the following manner:<br />VB<br />Imports System.Data<br />Imports System.Data.OleDb<br />C#<br />using System.Data;<br />using System.Data.OleDb;<br />Or in your ASPNet pages for (VB and C#)<br />&lt;%@ Import Namespace=&quot;System.Data&quot; %&gt;<br />&lt;%@ Import Namespace=&quot;System.Data.OleDb&quot; %&gt;<br />
    25. 25. Namespace<br />
    26. 26. Namespace<br />
    27. 27. Namespaces<br />
    28. 28. Namespaces<br />
    29. 29. tools provided by the .NET framework<br />The different types of tools provided are Configuration and Deployment tools, debugging tools, security tools and General tools.<br />
    30. 30. tools provided by the .NET framework<br />
    31. 31. tools provided by the .NET framework<br />
    32. 32. The Common Type System<br />Field. <br />A data variable that is part of the object’s state. Fields are identified by their name and type.<br />Method. <br /> A function that performs an operation on the object, often changing the object’s state. Methods have a name, signature, and modifiers. The signature specifies the calling convention, number of parameters (and their sequence), the types of the parameters, and the type of value returned by the method.<br />Property<br /> To the caller, this member looks like a field. But to the type implementer, this member looks like a method (or two). Properties allow an implementer to validate input parameters and object state before accessing the value and to calculate a value only when necessary; they also allow a user of the type to have simplified syntax. Finally, properties also allow you to create read-only or write-only “fields.”<br />Event. <br />A notification mechanism between an object and other interested objects.<br />
    33. 33. controlling access to a method or field<br />Private<br /> Callable only by other methods in the same class type.<br />Family<br /> Callable by derived types, regardless of whether they are within the same assembly. Note that many languages (like C++ and C#) refer to family as protected.<br />Family and Assembly<br /> Callable by derived types, but only if the derived type is defined in the same assembly.<br />Assembly.<br /> Callable by any code in the same assembly. Note that many languages refer to assembly as internal.<br />Family or Assembly<br /> Callable by derived types in any assembly and by any types in the same assembly. Note that C# refers to family or assembly as protected internal.<br />Public. <br />Callable by any code in any assembly.<br />
    34. 34. Using Value Types<br />There are three general value types:<br />Built-in types<br />User-defined types<br />Enumerations<br />
    35. 35. Built-in Value Types<br />BEST PRACTICES Optimizing performance with built-in types<br /> The runtime optimizes the performance of 32-bit integer types (Int32 and UInt32), so use those types for counters and other frequently accessed integral variables. For floating-point operations, Double is the most efficient type because those operations are optimized by hardware.<br />
    36. 36. C# 4.0 vs. Visual Basic 10<br />This is how close will become C# and VB in next release:<br />The items in * black-bold are new features…<br />