1 Net Framework Overview

Embed Size (px)

Citation preview

  • 8/10/2019 1 Net Framework Overview

    1/49

    .NET Framework Overview.NET Framework, CLR, MSIL, Assemblies, CTS, etc.

    Doncho Minkov

    http://academy.telerik.com/

    Technical Trainerhttp://www.minkov.it

    Telerik Software Academy

    http://academy.telerik.com/http://minkov.it/http://academy.telerik.com/school-academy/meetings/details/2012/01/06/desktop-applications-csharp-databaseshttp://minkov.it/http://academy.telerik.com/http://academy.telerik.com/http://academy.telerik.com/school-academy/meetings/details/2012/01/06/desktop-applications-csharp-databases
  • 8/10/2019 1 Net Framework Overview

    2/49

    Table of Contents

    1. What is .NET?

    Microsoft .NET platform architecture

    2. What is .NET Framework?

    .NET Framework Architecture

    3. Common Language Runtime (CLR)

    4. Managed Code

    5. Intermediate Language MSIL

    6. Assemblies and Metadata

    7. .NET Applications 2

  • 8/10/2019 1 Net Framework Overview

    3/49

    Table of Contents (2)

    8. Common Language Infrastructure (CLI) and

    integration of different languages

    Common Language Specification (CLS)

    Common Type System (CTS)

    9. Framework Class Library

    10. Integrated Development Environment Visual

    Studio

    3

  • 8/10/2019 1 Net Framework Overview

    4/49

    .NET FrameworkMicrosoft's Platform for

    Application Development

  • 8/10/2019 1 Net Framework Overview

    5/49

    What is the .NET Platform?

    The .NET platform

    Microsoft's platform for software development

    Unified technology for development of almostany kind of applications

    GUI / Web / RIA / mobile / server / cloud / etc.

    .NET platform versions

    .NET Framework

    Silverlight / Windows Phone 7

    .NET Compact Framework

    5

  • 8/10/2019 1 Net Framework Overview

    6/49

    What is .NET Framework?

    .NET Framework

    An environment for developing and executing.NET applications

    Unified programming model, set of languages,

    class libraries, infrastructure, components andtools for application development

    Environment for controlled execution of

    managed code

    It is commonly assumed that

    .NET platform == .NET Framework6

  • 8/10/2019 1 Net Framework Overview

    7/49

    .NET Framework Components

    Common Language Runtime(CLR)

    Environment for controlled execution ofprogrammed code like a virtual machine

    Executes .NET applications

    Framework Class Library(FCL)

    Standard class library for .NET development

    Delivers basic functionality for developing: XML,ADO.NET, LINQ, ASP.NET, WPF, WCF, WWF,Silverlight, Web services, Windows Forms, ...

    SDK, compilers and tools 7

  • 8/10/2019 1 Net Framework Overview

    8/49

    .NET Framework Architecture

    The OS manages the resources, theprocesses and the users of the machine

    Provides to the applications some

    services (threads, I/O, GDI+, DirectX,COM, COM+, MSMQ, IIS, WMI, )

    CLR is a separate process in the OS

    Operating System (OS)

    8

  • 8/10/2019 1 Net Framework Overview

    9/49

    Operating System (OS)

    Common Language Runtime (CLR)

    CLR manages the execution ofthe.NET code

    Manages the memory,

    concurrency, security, ...

    .NET Framework Architecture (2)

    CLR

    9

  • 8/10/2019 1 Net Framework Overview

    10/49

    Operating System (OS)

    Common Language Runtime (CLR)

    Base Class Library (BCL)

    .NET Framework Architecture (3)

    Rich object-oriented library withfundamental classes

    Input-output, collections, text

    processing, networking, security,multi-threading,

    10

  • 8/10/2019 1 Net Framework Overview

    11/49

    Operating System (OS)

    Common Language Runtime (CLR)

    Base Class Library (BCL)

    ADO.NET, LINQ and XML (Data Tier)

    .NET Framework Architecture (4)

    Database access

    ADO.NET, LINQ, LINQ-to-SQL andEntity Framework

    Strong XML support

    11

  • 8/10/2019 1 Net Framework Overview

    12/49

    Operating System (OS)

    Common Language Runtime (CLR)

    Base Class Library (BCL)

    ADO.NET, LINQ and XML (Data Tier)

    .NET Framework Architecture (5)

    WCF and WWF (Communication and Workflow Tier)

    Windows CommunicationFoundation (WCF) and WindowsWorkflow Foundation (WWF) forthe SOA world

    12

  • 8/10/2019 1 Net Framework Overview

    13/49

    Operating System (OS)

    Common Language Runtime (CLR)

    Base Class Library (BCL)

    ADO.NET, LINQ and XML (Data Tier)

    .NET Framework Architecture (6)

    WCF and WWF (Communication and Workflow Tier)

    ASP.NETWeb Forms, MVC, AJAX

    Mobile Internet Toolkit

    Windows

    Forms

    WPF Silverlight

    User interface technologies: Web based,Windows GUI, WPF, Silverlight, mobile,

    13

  • 8/10/2019 1 Net Framework Overview

    14/49

    Operating System (OS)

    Common Language Runtime (CLR)

    Base Class Library (BCL)

    ADO.NET, LINQ and XML (Data Tier)

    .NET Framework Architecture (7)

    WCF and WWF (Communication and Workflow Tier)

    ASP.NETWeb Forms, MVC, AJAX

    Mobile Internet Toolkit

    Windows

    Forms

    WPF Silverlight

    C# C++ VB.NET J# F# JScript Perl Delphi

    Programming language on your flavor!

    14

  • 8/10/2019 1 Net Framework Overview

    15/49

    .NET Framework 4.0

    15

  • 8/10/2019 1 Net Framework Overview

    16/49

    The Future

    16

  • 8/10/2019 1 Net Framework Overview

    17/49

    Common Language

    Runtime (CLR)The Heart of .NET Framework

  • 8/10/2019 1 Net Framework Overview

    18/49

    Common Language Runtime (CLR)

    Managed execution environment

    Controls the execution of managed .NETprogramming code

    Something like virtual machine

    Like the Java Virtual Machine (JVM)

    Not an interpreter

    Compilation on-demand is used Known as Just In Time (JIT) compilation

    Possible compilation in advance (Ngen)

    18

  • 8/10/2019 1 Net Framework Overview

    19/49

    Responsibilities of CLR

    Execution of the IL code and the JIT

    compilation

    Managing memory and application resources

    Ensuring type safety

    Interaction with the OS

    Managing security Code access security

    Role-based security

    19

  • 8/10/2019 1 Net Framework Overview

    20/49

    Responsibilities of CLR (2)

    Managing exceptions Managing concurrency controlling the

    parallel execution of application threads

    Managing application domains and theirisolation

    Interaction with unmanaged code

    Supporting debug /

    profile of .NET code

    20

  • 8/10/2019 1 Net Framework Overview

    21/49

    CLR Architecture

    Class Loader

    IL to NativeJIT Compiler

    CodeManager

    GarbageCollector

    Security Engine Debug Engine

    Type Checker Exception Manager

    Thread Support COM Marshaler

    Base Class Library Support

    21

  • 8/10/2019 1 Net Framework Overview

    22/49

    Managed andUnmanaged Code

    What is the Difference?

  • 8/10/2019 1 Net Framework Overview

    23/49

    Managed Code

    CLR executed code is called managed code

    Represents programming code in the low levellanguage MSIL(MS Intermediate Language)

    Contains metadata

    Description of classes, interfaces, properties,fields, methods, parameters, etc.

    Programs, written in any .NET language are Compiled to managed code (MSIL)

    Packaged as assemblies (.exeor .dllfiles)

    23

  • 8/10/2019 1 Net Framework Overview

    24/49

    Managed Code (2)

    Object-oriented Secure

    Reliable

    Protected from irregular use of types (type-safe)

    Allows integration between components anddata types of different programming

    languages

    Portable between different platforms

    Windows, Linux, Max OS X, etc.24

  • 8/10/2019 1 Net Framework Overview

    25/49

    Unmanaged (Win32) Code

    No protection of memory and type-safety

    Reliability problems

    Safety problems

    Doesnt contain metadata Needs additional overhead like (e.g. use COM)

    Compiled to machine-dependent code

    Need of different versions for differentplatforms

    Hard to be ported to other platforms

    25

  • 8/10/2019 1 Net Framework Overview

    26/49

    Memory Management

    CLR manages memory automatically

    Dynamically loaded objects are stored in themanaged heap

    Unusable objects are automatically cleaned up

    by the garbage collector

    Some of the big problems are solved

    Memory leaks

    Access to freed or unallocated memory

    Objects are accessed through a reference

    26

  • 8/10/2019 1 Net Framework Overview

    27/49

    IntermediateLanguage (MSIL)

    I t di t L

  • 8/10/2019 1 Net Framework Overview

    28/49

    Intermediate Language(MSIL, IL, CIL)

    Low level language (machine language) for the.NET CLR

    Has independent set of CPU instructions

    Loading and storing data, calling methods

    Arithmetic and logical operations

    Exception handling

    Etc.

    MSIL is converted to instructions for the

    current physical CPU by the JIT compiler 28

  • 8/10/2019 1 Net Framework Overview

    29/49

    Sample MSIL Program

    .method private hidebysig static void Main() cil managed

    {

    .entrypoint

    // Code size 11 (0xb)

    .maxstack 8

    ldstr "Hello, world!"

    call void

    [mscorlib]System.Console::WriteLine(string)

    ret} // end of method HelloWorld::Main

    29

  • 8/10/2019 1 Net Framework Overview

    30/49

    Compilation and Execution

    Compilation

    Execution

    JITcompiler

    Machinecode

    MSILCode

    Metadata

    Sourcecode

    Languagecompiler

    Assembly

    (.EXE or

    .DLL file)

    When given

    method is called

    for the first time

    Pre-compilationduring the install

    (NGEN)

    30

  • 8/10/2019 1 Net Framework Overview

    31/49

    .NET ApplicationsAssemblies, Metadata and Applications

  • 8/10/2019 1 Net Framework Overview

    32/49

    .NET Assemblies

    .NET assemblies:

    Self-containing .NET components

    Stored in .DLL and .EXE files

    Contain list of classes, types and resources

    Smallest deployment unit in CLR

    Have unique version number

    .NET deployment model No version conflicts (forget the "DLL hell")

    Supports side-by-side execution of different

    versions of the same assembly 32

  • 8/10/2019 1 Net Framework Overview

    33/49

    Metadata in the Assemblies

    Metadata in the .NET assemblies

    Data about data contained in the assembly

    Integral part of the assembly

    Generated by the .NET languages compiler

    Describes all classes, their class members,versions, resources, etc.

    33

    d i bli

  • 8/10/2019 1 Net Framework Overview

    34/49

    Metadata in Assemblies

    Type Description

    Assembly Description

    Classes, interfaces, inner types, baseclasses, implemented interfaces,member fields, properties, methods,method parameters, return value,attributes, etc.

    Dependencies on other assembliesSecurity permissionsExported types

    [digital

    signature]

    Name

    Version

    Localization

    34

    li i

  • 8/10/2019 1 Net Framework Overview

    35/49

    .NET Applications

    Configurable executable .NET units

    Consist of one or more assemblies

    Installed by "copy / paste"

    No complex registration of components Different applications use different versions of

    common assemblies

    No conflicts due to their "strong name" Easy installation, un-installation and update

    35

    C S (C S)

  • 8/10/2019 1 Net Framework Overview

    36/49

    Common Type System (CTS)

    CTS defines the CLR supported types of dataand the operations over them

    Ensures data level compatibility between

    different .NET languages E.g. stringin C# is the same like Stringin

    VB.NET and in J#

    Value types and reference types All types derive from System.Object

    36

  • 8/10/2019 1 Net Framework Overview

    37/49

    The .NET LanguagesC#, VB.NET, C++, J#, etc.

    NET L

  • 8/10/2019 1 Net Framework Overview

    38/49

    .NET Languages

    .NET languages by Microsoft

    C#, VB.NET, Managed C++, J#, F#, JScript

    .NET languages by third parties

    Object Pascal, Perl, Python, COBOL, Haskell,Oberon, Scheme, Smalltalk

    Different languages can be mixed in a single

    application Cross-language inheritance of types and

    exception handling

    38

    C# L

  • 8/10/2019 1 Net Framework Overview

    39/49

    C# Language

    C# is mixture between C++, Java and Delphi

    Fully object-oriented by design

    Component-oriented programming model

    Components, properties and events

    No header files like C/C++

    Suitable for GUI and Web applications

    XML based documentation

    In C# all data types are objects

    Example: 5.ToString()is a valid call39

    C# L E l

  • 8/10/2019 1 Net Framework Overview

    40/49

    C# Language Example

    C# is standardized by ECMA and ISO Example of C# program:

    using System;

    class NumbersFrom1to100

    {

    static void Main()

    {

    for (int i=1; i

  • 8/10/2019 1 Net Framework Overview

    41/49

    Framework Class

    Library (FCL)Standard Out-of-the-box .NET APIs

    F k Cl Lib (FCL)

  • 8/10/2019 1 Net Framework Overview

    42/49

    Framework Class Library (FCL)

    Framework Class Library is the standard.NET Framework library of out-of-the-boxreusable classes and components (APIs)

    Base Class Library (BCL)

    ADO.NET, LINQ and XML (Data Tier)

    WCF and WWF (Communication and Workflow Tier)

    ASP.NETWeb Forms, MVC, AJAXMobile Internet Toolkit

    WindowsForms

    WPF Silverlight

    42

    FCL N

  • 8/10/2019 1 Net Framework Overview

    43/49

    FCL Namespaces

    ADO.NET, LINQ and XML (Data Tier)

    WCF and WWF (Communication and Workflow Tier)

    ASP.NETWeb Forms, MVC, AJAXMobile Internet Toolkit

    WindowsForms

    WPF & Silverlight

    System.Web

    System.Web.Mvc

    System.Windows

    .Forms

    System.Drawing

    System.Windows

    System.Windows.Media

    System.Windows.Markup

    System.ServiceModel System.Activities System.Workflow

    System.Data System.Linq

    System.Data.Linq

    System.Xml

    System.Xml.Linq System.Data.Entity

    43

  • 8/10/2019 1 Net Framework Overview

    44/49

    Visual Studio IDEPowerful Development Environment for .NET

    Vi l St di

  • 8/10/2019 1 Net Framework Overview

    45/49

    Visual Studio

    Visual Studio is powerful Integrated

    Development Environment (IDE) for .NETDevelopers

    Create, edit, compile and run .NET applications

    Different languages C#, C++, VB.NET, J#,

    Flexible code editor

    Powerful debugger

    Integrated with SQL Server and IIS

    Strong support of Web services, WCF and WWF

    45

    Vi l St di ( )

  • 8/10/2019 1 Net Framework Overview

    46/49

    Visual Studio (2)

    Visual programming

    Component-oriented, event based

    Managed and unmanaged code

    Helpful wizards and editors Windows Forms Designer

    WCF / Silverlight Designer

    ASP.NET Web Forms Designer

    ADO.NET / LINQ-to-SQL / XML Data Designer

    Many third party extensions46

  • 8/10/2019 1 Net Framework Overview

    47/49

    N F t i C#

  • 8/10/2019 1 Net Framework Overview

    48/49

    , ,

    SEO -

    ,HTML,CSS,JavaScript,Photoshop

    ASP.NETMVC HTML,SQL,C#,.NET,ASP.NETMVC

    " cloud"

    BGCoder - - onlinejudge

    ,

    " "

    ,

    ASP.NET - ,,C#,.NET,ASP.NET

    iPhone,Android,WP7,PhoneGap

    freeC#book,C#,Java,C#- -

    C#,,

    New Features in C# 4.0

    http://academy.telerik.com

    F T i i @ T l ik A d

    http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://academy.telerik.com/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://academy.telerik.com/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://www.introprogramming.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://www.introprogramming.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://academy.telerik.com/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://www.introprogramming.info/http://www.introprogramming.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://www.introprogramming.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://www.introprogramming.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://academy.telerik.com/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://www.introprogramming.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://csharpfundamentals.telerik.com/http://academy.telerik.com/http://academy.telerik.com/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://csharpfundamentals.telerik.com/http://www.nikolay.it/http://www.minkov.it/http://www.introprogramming.info/http://mobiledevcourse.telerik.com/http://academy.telerik.com/http://aspnetcourse.telerik.com/http://algoacademy.telerik.com/http://codecourse.telerik.com/http://www.nakov.com/http://www.bgcoder.com/http://clouddevcourse.telerik.com/http://mvccourse.telerik.com/http://schoolacademy.telerik.com/http://html5course.telerik.com/http://seocourse.telerik.com/http://www.telerik-kids.com/http://forums.academy.telerik.com/http://csharpfundamentals.telerik.com/http://www.nikolay.it/http://www.minkov.it/http://www.introprogramming.info/http://mobiledevcourse.telerik.com/http://academy.telerik.com/http://aspnetcourse.telerik.com/http://algoacademy.telerik.com/http://codecourse.telerik.com/http://www.nakov.com/http://www.bgcoder.com/http://clouddevcourse.telerik.com/http://mvccourse.telerik.com/http://schoolacademy.telerik.com/http://html5course.telerik.com/http://seocourse.telerik.com/http://www.telerik-kids.com/http://kursove-uroci-knigi-obuchenie-programirane-web-design-csharp.info/http://forums.academy.telerik.com/
  • 8/10/2019 1 Net Framework Overview

    49/49

    Free Trainings @ Telerik Academy

    "C# and Databases " course @ Telerik

    Academy academy.telerik.com/csharp-databases

    Telerik Software Academy

    academy.telerik.com

    Telerik Academy @ Facebook

    facebook.com/TelerikAcademy

    Telerik Software Academy Forums

    forums.academy.telerik.com

    http://academy.telerik.com/school-academy/meetings/details/2012/01/06/desktop-applications-csharp-databaseshttp://academy.telerik.com/school-academy/meetings/details/2012/01/06/desktop-applications-csharp-databaseshttp://academy.telerik.com/http://www.facebook.com/telerikacademyhttp://forums.academy.telerik.com/http://academy.telerik.com/school-academy/meetings/details/2012/01/06/desktop-applications-csharp-databaseshttp://facebook.com/TelerikAcademyhttp://academy.telerik.com/http://forums.academy.telerik.com/http://forums.academy.telerik.com/http://www.facebook.com/telerikacademyhttp://academy.telerik.com/http://academy.telerik.com/school-academy/meetings/details/2012/01/06/desktop-applications-csharp-databaseshttp://academy.telerik.com/school-academy/meetings/details/2012/01/06/desktop-applications-csharp-databaseshttp://academy.telerik.com/school-academy/meetings/details/2012/01/06/desktop-applications-csharp-databaseshttp://academy.telerik.com/school-academy/meetings/details/2012/01/06/desktop-applications-csharp-databases