• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Microsoft.Net
 

Microsoft.Net

on

  • 2,249 views

An Introduction on .NET Framework

An Introduction on .NET Framework

Statistics

Views

Total Views
2,249
Views on SlideShare
2,249
Embed Views
0

Actions

Likes
5
Downloads
0
Comments
2

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

12 of 2 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Microsoft.Net Microsoft.Net Presentation Transcript

    • Microsoft .NET Framework Ch. Vishwa Mohan M.Sc., M.Tech Freelance Software Consultant & Corporate Trainer
      • Introduction to .NET Framework
      • Introduction to Visual Studio
      • C# Language
      • Advanced .NET Programming
      • Windows Based Application Development
      • ASP.NET Web Development.
      Table of Contents
      • Microsoft.NET is a set of Microsoft software technologies for connecting information, people, systems and devices.
        • It enables high level of software integration through the use of XML Web Services.
      • The .NET is a platform that provides a standardized set of services:
        • It’s just like Windows, except distributed over the Internet.
        • It exports a common interface so that it’s programs can be run on any system that supports .Net.
      • Goals of .NET
        • Tie all devices to the Internet
        • Software as a service
        • Data and applications accessible on all devices
          • Truly compile once, run anywhere
          • Scalability
      What is .NET ?
      • .NET was designed to replace all legacy Microsoft Languages
        • J++, C++, ASP, Visual Basic.
      • Offers Language uniformity.
      • .NET Provides Common Intermediate Language IL (or MSIL)
        • IL concept is based on CLI. CLI is a standard not a language.
        • C#, VB.NET, J# compiles into IL.
        • Non-interpreted, Just-In-Time (JIT) Compiled Code.
        • Each client has CLR.
      • CLR is your sandbox. Provides safe environment for code execution.
      An Overview on .NET
    • Code Execution in .NET
      • Choosing CLR complaint compiler
      • Compile your code into Microsoft Intermediate Language MSIL (or IL assembly language code).
      • Compiling MSIL into Native Code.
        • Compilation by Just-in-time compiler
        • Install-time Code generation using NGen.exe.
      • Executing Code.
      Managed Execution Process
    • Compilation and Execution Cycle Compilation Before installation or the first time each method is called Execution JIT Compiler Native Code MSIL Code Metadata Source Code Language Compiler
    • Why do you need .NET Framework 3.5? Create applications that run anywhere: mobile devices, browsers, desktops, and servers Enables better collaboration between developers and designers to create rich user experiences Productivity improvements like LINQ to provide a single platform for quickly building apps that run anywhere Simplifies building applications with messaging systems and/or workflows Connected Compelling Ubiquitous & Productive
    • Different Versions of .NET Framework Microsoft .NET Framework v2.0 Microsoft .NET Framework v3.5 Microsoft .NET Framework v1.1 Microsoft .NET Framework v3.0 Microsoft .NET Framework v1.0 Microsoft .NET Framework v4.0
      • Common language runtime (CLR).
      • Support for generic types and methods.
      • Compilers for C#, Visual Basic, C++, and J#.
      • Base class libraries.
      • ADO.NET.
      • ASP.NET.
      • Windows Forms.
      • XML Web services.
      • .NET Remoting
      Technologies in .NET Framework V2.0
    • What was new in .NET Framework 3.0? build user interfaces for applications and media-rich experiences build and run connected systems, with a focus on Web services build workflow-enabled applications build secure online user authentication .NET FRAMEWORK Windows Presentation Foundation (WPF) Windows Workflow Foundation (WF) Windows Communication Foundation (WCF) Windows Cardspace
    • What is Microsoft .NET Framework 3.5?
      • 2.0 = ASP.NET, CLR, Web Services, WinForms
      • 3.0 = Cardspace, WCF, WF, WPF
      • 3.5 = AJAX, LINQ, REST, RSS
      .NET Framework 3.5 .NET Framework 3.0 SP1 Microsoft Visual Studio 2008 .NET Framework 2.0 SP1
      • Support for developing AJAX enabled web sites.
        • Both server centric and Client centric.
      • New compilers for C#, Visual Basic, and C++.
      • Support for ASMX and WCF based Web Services.
      • Enhancements in CLR includes:
      • Improvement in Networking.
      • New web protocols in WCF.
      • Integration of WCF with WF
        • Exposing WF workflow as WCF service.
      • LINQ & Data Awareness
      • Expression Tress
      • Full tooling support in VS2008 for WF, WCF and WPF.
      Enhancements in .NET Framework V3.5
    • Introduction to .NET Architecture Microsoft .NET Framework
      • The .NET Framework supports building and running different kinds of applications and Web services.
      • The .NET Framework designed to fulfill the following:
        • To provide code execution environment :
          • To minimize software deployment and versioning problems,
          • Supporting safe execution of code (i.e., code access security)
          • Eliminates performance problems of scripted or interpreted environments.
        • Same type of development environment for Windows based and Web based applications.
        • Ensured all external communications are industrial standards so that code based on .NET framework can integrate with any other code.
      • The .NET Framework has two main components:
        • Common Language Runtime (CLR)
        • .NET Framework Class Library
      Overview of .NET Framework
    • .NET Framework Platform & Tools Operating System Common Language Runtime Base Class Library ADO.NET and XML ASP.NET Web Forms Web Services Windows® Forms Common Language Specification VB C++ C# J# …
    • CLR Internals Class Loader IL to Native Compilers Code Manager Garbage Collector Security Engine Debug Engine Type Checker Exception Manager Thread Support COM Marshaler Base Class Library Support
      • The CLR is the execution engine for the .NET framework applications.
      • Code running under the control of the CLR often referred as managed code.
      • CLR provides,
        • Code management (loading and executions)
        • Application memory isolation
        • Automatic memory management.
        • Enforcement of code access security.
        • Built in support for language interoperability.
        • Exception handling, including cross-language exceptions.
        • Thread Management
        • Enforcing strict type checking to promote robustness.
        • Interop Services for old COM objects and DLL’s.
        • Versioning problems solved. Removal on Registration dependency.
      Common Language Runtime (CLR)
      • Microsoft Ships Several Languages:
        • C#,
        • VB.NET
        • C++ (With managed extensions)
        • JScript.NET
        • J#,
        • ILasm
      Languages Targeted for CLR
      • Third Party Languages
        • Eiffel by Eiffel Software
        • COBOL by Fujistu
        • FORTRON
        • Delphi by Borland
        • Perl by ActiveState
        • Many Research toy languages.
      • The .NET Framework, is a comprehensive, object-oriented collection of reusable types that tightly integrate with CLR. These types can be used to develop any type of applications like Console based, Traditional GUI or Web Applications.
      • The .NET framework types perform the following functions.
        • Represent base data types and functions.
        • Encapsulate data structures.
        • Perform I/O
        • Access information about loaded types.
        • Invoke .NET framework security check.
        • Provide data access.
      The .NET Framework Class Library
      • The .NET Framework has a rich set of class library.
      • This class library provides a common consistent development interface across all languages supported by .NET.
      • The .NET Class Library consists classes for IO, Threading, Database, Text, Graphics, Socket, Web/Mail, Security, Cryptography , etc.,
      • The Class Library major parts are:
        • Base Frame Work
        • Data and XML
        • ASP.NET
        • Windows Forms
      • These classes are arranged using dot syntax naming scheme that connotes a hierarchy. It also called as Namespace.
        • Eg: System.Collection.ArrayList represents ArrayList type which belongs to System.Collection Namespace.
        • System name space is the root namespace for the fundamental types of .NET.
      The .NET Framework Class Library
    • The .NET Unified Classes Diagnostics Configuration Collections Net IO Threading Text Security Common OLEDB SQLTypes SQLClient XPath XSL Runtime InteropServices Remoting Serialization Serialization Configuration SessionState Caching Security Services UI HTMLControls WebControls Imaging Drawing2D Text Printing Design ComponentModel Schema Reflection Resources Globalization ServiceProcess System System.XML System.Web (ASP .NET) System.Drawing System.Windows.Forms System.Data Schema Description Discovery Protocols
    • Relationship between CLR, Class Library and Your Application.
      • Any code before executed by the CLR need to be compiled. Compilation occurs in two steps in .NET
        • Compilation of source code in to IL.
        • Compilation of IL to platform specific code by CLR.
      • Advantages of Managed Code:
        • Platform Independency
        • Language Interoperability
        • Performance Improvement
      • IL is a classic Object Oriented programming language with single implementation inheritance of classes. So any language that targeting to IL need to follow this methodology. Some of the important features of IL:
        • Object orientation and use of interfaces.
        • Strong distinction between value types and reference types.
        • Strong data typing
        • Use of attributes.
        • Error Handling using exceptions.
      Advantages of Managed Code
      • In .NET,
        • All objects implicitly derived from single base class System.Object .
        • The CTS is the core part of the CLR that takes cares cross language integration.
        • The CTS offers wide range of types and operations that found in many programming languages.
        • The CTS supports two general categories of types:
          • Value Types : Include simple types (char, int, float, etc.,), enum types and struct types.
          • Reference Types : Includes class types, interface type, delegate types and array types.
      • The common Type System performs the following functions:
        • Facilitates cross-language integration, type-safety and high performance code execution.
        • Provides an object-oriented model and defines a set of rules that language have to follow.
      Common Type System (CTS)
      • In .NET,
        • A class written in one language can inherit a class written in another language.
        • The class can contain instance of another class written in different language.
        • An object can directly call methods against another object written in another language.
        • Object (or reference to objects) can be passed around between methods.
      • To address the above, one language need to support equivalent data types present in different language. This data type problem solved in .NET through the Common Type System .
        • The CTS defines the predefined data types that are available in IL. So all the languages that targets the .NET will produce the compiled code ultimately based on these types.
        • The CTS doesn’t specify merely primitive data types but a rich hierarchy of types. Everything actually an object.
        • Specifies rules for Class, Enum, Struct, interface, delegate, etc.,
      Common Type System (CTS)
      • The CTS defines how types are declared, used and managed in the runtime. So runtime can support cross language integration.
      • The CTS performs the following functions:
        • Establishes a framework that helps enable cross-language integration, type safety, and high performance code execution.
        • Provides an object-oriented model that supports the complete implementation of many programming languages.
        • Defines rules that languages must follow, which helps ensure that objects written in different languages can interact with each other.
      • The Common Type System supports two general categories of types, each of which is sub divided into further categories:
        • Value Types
        • Reference Types.
      • All types derived from System.Object base type.
      Common Type System (CTS)
      • Below diagram shows various types and their relations.
        • Instance of a type can be simply value type or self describing type even though they are sub categories of these types.
        • In C#, each predefined type recognized by the compiler and maps into one of the IL built-in types.
      Type Classification
      • CLS rules define a subset of the CTS; i.e., all the rules that apply to the CTS apply to the CLS, except where stricter rules are defined in the CLS.
      • The CLS works with the CTS to ensure language interoperability. The CLS is a set of standards that all compilers targeting to .NET must support.
        • Most of the compilers will support the subset features offered by the IL and CTS. (Because IL is very rich language).
        • It is perfect to write non-CLS complaint code. But it is not guaranteed to be fully language interoperable.
        • CLS-complaint features applies only to public and protected members of classes and public classes .
        • Within the private implementation of class you can write whatever non-CLS code you want.
      • The common language runtime compiles all code written in a CLS-compliant language, to the same kind of intermediate code (IL) –MSIL.
      • You can mark assemblies, modules, types, and members as either CLS-compliant or not CLS compliant using the CLSCompliantAttribute.
      Common Language Specifications (CLS)
      • Automatic management is one of the services provided by CLR during managed execution.
      • Automatic memory management can eliminate common problems, such as forgetting to free an object and causing a memory leak, or attempting to access memory for an object that has already been freed.
        • CLR’s Garbage collector will do all theses memory management activities.
      • Garbage collector will release the memory for the unused objects at free time.
      • To optimize the performance of the garbage collector, the managed heap is divided into three generations: 0, 1, and 2.
      • Unmanaged resources require explicit cleanup. (Eg: Object wraps OS resources such as file handle, windows handle, network connection).
        • GC knows the lifetime of the object that wraps these resources. But it doesn’t aware of these resources. So release these resources you need to done in public Dispose method.
      Automatic Memory Management
      • An assembly is a unit of deployment.
      • Assembly contains code that CLR executes. MSIL code in PE file will not execute if it doesn’t have assembly manifest.
      • Each assembly can have only one entry point ( DllMain , WinMain or Main ).
      • Assembly forms security boundary. So permissions requested at assembly level.
      • Assembly forms version boundary. Assembly is the smallest versionable unit in the CLR.
      • Assemblies are self describing.
      • Assemblies can be static and dynamic.
      • Within Assembly Type information (metadata) Consists of:
        • Describes every class type.
        • Complete Interface Information.
        • Automatically bound into assembly, inseperable, stored in binary format.
      Assemblies in .NET
    • Assemblies in .NET
      • Assembly is nothing but .NET Library or Executable (PE file format).
      • Single-file or multi-file assemblies.
      • Assembly components are: Metadata, IL Code, Resources.
      • Assemblies eliminate DLL problem.
      • Locations are resolved at runtime.
      • Assembly can contain both managed and unmanaged code.
      Assemblies: Assemblies Metadata
      • Assemblies cab have Strong name and Version number
      • Publisher can set versioning policy. Publisher can provide strong name to assembly.
      • Domain/Local Administrator can set versioning policy.
      • The runtime resolve several steps to resolve an assembly binding:
        • Checks the original assembly reference to determine the version of the assembly to be bound.
        • Checks for all applicable configuration files to apply version policy.
        • Determines the correct assembly from the original assembly reference and any redirection specified in the configuration files, and determines the version that should be bound to the calling assembly.
        • Checks the GAC, Multiple versions can be loaded side-by-side.
      • Each assembly have two distinct ways of expressing version information:
        • Version Number together with assembly name and culture info.
        • Informational version.
      Assembly Versioning
      • Managed code runs within the protective confines of the CLR.
      • Before the CLR Executes code:
        • Verifies it for type safety.
        • Enforces the Code Access Security Policy.
      • Remember the CLR sits on top of Windows:
        • CLR Security complements windows security (doesn’t replace).
      • .NET Strongly Enforces the Microsoft Mantra “ Do it our way ”.
        • Security by design by default.
        • “ The Microsoft Way” is secure and easy. Microsoft encourage developers to write secure code by making security implementations easy way.
        • Hard work to make .NET applications insecure.
        • IL can be verified to guarantee type safety
        • No unsafe casts, no un-initialized variables and no out-of-bounds array indexing.
      Security in .NET
      • Role-based security.
      • Evidence-based, Code Access Securiy
        • Declarative Security
        • Imperative Security
      • Isolated Storage Container
      • Link Demands
      • Cryptography
      • Partially Trusted files can be read/write files through by using standard dialogs.
      .NET Security Mechanism
      • Type safety verification performed during JIT compile.
      • Primary functions:
        • Ensures methods are called in correct manner (parameters, etc.,).
        • Authorize memory access (thus preventing buffer overruns etc.,)
        • Apply CAS policy.
      • Code produced by C# unsafe keyword cannot be checked.
        • Higher privileges required to run unsafe code.
      • .NET protective environment allows multiple applications to run within one process:
        • 1 .NET Process = Multiple Application Domains.
      Type Safety Verification
      • Code Access Security (CAS)
        • Grants rights to code depending on “ evidence ”.
        • Unlike Win32 security not based on User’s ID but “ Code’s ID ”.
      • Two primary concepts in CAS are:
        • Code Groups:
          • Compartmentalizes code based on “membership criteria”, e.g.:
            • Location (Internet, Intranet, Local Hard drive)
            • Strong Name (Private Key signature)
            • Custom Criteria (Authentication, XML Signature, etc.,).
          • Code with matching criteria is encapsulated into a Code Group .
            • A Code Group is associated with a Permission Set .
        • Permission Sets:
          • Detailed list of what code can do.
          • Very specific/granular.
      Code Access Security
      • Application domains provide an isolation boundary for security, reliability, and versioning, and for unloading assemblies.
      • Application domains are typically created by runtime hosts.
      • You can run several application domains in a single process:
        • With the same level of isolation between application domains that would exist in separate processes, but without incurring the additional overhead of making cross-process calls or switching between processes.
        • Dramatically increases server scalability.
      • The isolation provided by application domains has the following benefits:
        • Faults in one application cannot affect other applications.
        • Individual applications can be stopped without stopping the entire process.
        • Code running in one application cannot directly access code or resources from another application.
        • Permissions granted to code can be controlled by application domain in which it is running.
      Application Domains:
      • At run time, all managed code is loaded into an application domain and is run by a managed thread .
        • There is not a one-to-one correlation between application domains & threads.
        • Several threads can be executing in a single application domain at any given time and a particular thread is not confined to a single application domain.
          • Threads are free to cross application domain boundaries;
          • A new thread is not created for each application domain.
          • The run time keeps track of which threads are running in which application domains.
          • You can locate the domain in which a thread is executing at any time by calling the GetDomain method.
      • Application domains are usually created and manipulated programmati-cally by runtime hosts.
      • The AppDomain class is the programmatic interface to application domains. It has methods to Execute assembly, Unload assembly, etc.,
      Application Domains:
      • Why we need Interoperability?
        • Allow managed and unmanaged code work together.
        • Reusability of COM components.
        • Usage of Windows native API.
      • Challenges for Interoperability are:
        • Synchronize Memory Allocation
        • Object Lifetime Management
        • Security
        • Two Way Communication
      • PInvoke: Efficient and relatively easy way to call existing native code, without having to write glue code.
      • Managed C++ / C++/CLI: Very powerful way to write glue code for complex object models.
      • COM Interop: COM Interfaces and Objects can be used by .NET and Vice Versa.
      Integration with Legacy Code
      • The common language runtime has been designed to support a variety of different types of applications. Each type of application requires a runtime host to start it.
      • The .NET Framework ships with a number of different runtime hosts, includes:
        • ASP.NET
        • Microsoft IE
        • Shell Executable
      • Microsoft also provides API to create your own runtime hosts.
      Runtime Hosts
      • You can access data uses ADO.NET.
      • GDI+ allows advanced drawing.
      • Your windows application can make calls exposed through XML web services.
      • You can access OS services.
      • You can develop multi tier distributed applications with the help of .NET.
      • Improved localization support.
      • Windows forms features a security model that is code-based.
      • Extensive XML Supporting classes.
      • With WPF you can build rich media aware applications.
      Benefits of Windows Applications with .NET
      • Ch. Vishwa Mohan
      • M.Sc., M.Tech
      • Web: http://in.linkedin.com/in/vishwam
      • Phone: +91- 9490995632
      For More Details