Net framework
This presentation is the property of its rightful owner.
Sponsored Links
1 / 45

.Net Framework PowerPoint PPT Presentation


  • 101 Views
  • Uploaded on
  • Presentation posted in: General

.Net Framework. Joel Pereira ([email protected]) Software Design Engineer WinFS API Team Microsoft Corporation. Agenda. Part I - Fundamentals Programming Models Design Goals and Architecture CLR Services Part II – Visual Studio 2005 Extending the Platform Improving the Platform

Download Presentation

.Net Framework

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Net framework

.Net Framework

Joel Pereira ([email protected])

Software Design Engineer

WinFS API Team

Microsoft Corporation


Agenda

Agenda

  • Part I - Fundamentals

    • Programming Models

    • Design Goals and Architecture

    • CLR Services

  • Part II – Visual Studio 2005

    • Extending the Platform

    • Improving the Platform

    • Innovation in the Platform


Unify programming models

Consistent API availability regardless of

language and programming model

.NET Framework

RAD,

Composition,

Delegation

Subclassing,

Power,

Expressiveness

Stateless,

Code embedded

in HTML pages

ASP

VB Forms

MFC/ATL

Windows API

Unify Programming Models


Make it simple to use

Make It Simple To Use

  • Organization

    • Code organized in hierarchical namespaces and classes

  • Unified type system

    • Everything is an object, no variants, one string type, all character data is Unicode

  • Component Oriented

    • Properties, methods, events, and attributes are first class constructs

    • Design-time functionality


How much simpler

How Much Simpler?

Windows API

HWND hwndMain = CreateWindowEx(

0, "MainWClass", "Main Window",

WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL,

CW_USEDEFAULT, CW_USEDEFAULT,

CW_USEDEFAULT, CW_USEDEFAULT,

(HWND)NULL, (HMENU)NULL, hInstance, NULL);

ShowWindow(hwndMain, SW_SHOWDEFAULT);

UpdateWindow(hwndMain);

.NET Framework

Form form = new Form();

form.Text = "Main Window";

form.Show();


Hello world demo

Hello World Demo

  • What you need


Agenda1

Agenda

  • Part I - Fundamentals

    • Programming Models

    • Design Goals and Architecture

    • CLR Services

  • Part II – Visual Studio 2005

    • Extending the Platform

    • Improving the Platform

    • Innovation in the Platform


Common language runtime design goals

Common Language RuntimeDesign Goals

  • Dramatically simplifies development and deployment

  • Unifies programming models

  • Provides robust and secure execution environment

  • Supports multiple programming languages


Architectural overview

ExecutionSupport

Security

IL to native code compilers

Architectural Overview

Framework

Base Classes

Common Language Runtime

GC, stack walk, code manager

Class loader and layout


Compilation and execution

Assembly

Language Compiler

Native

Code

JIT Compiler

Execution

Compilation And Execution

Compilation

Code (IL)

Source Code

Metadata

At installation or the first time each method is called


Languages

Languages

  • The CLR is Language Neutral

    • All languages are first class players

    • You can leverage your existing skills

  • Common Language Specification

    • Set of features guaranteed to be in all languages

  • We are providing

    • VB, C++, C#, J#, JScript

  • Third-parties are building

    • APL, COBOL, Pascal, Eiffel, Haskell, ML, Oberon, Perl, Python, Scheme, Smalltalk…


Hello world demo1

Hello World Demo

  • What you need

  • MSIL


Agenda2

Agenda

  • Part I - Fundamentals

    • Programming Models

    • Design Goals and Architecture

    • CLR Services

  • Part II – Visual Studio 2005

    • Extending the Platform

    • Improving the Platform

    • Innovation in the Platform


Component based programming

Component-Based Programming

  • 3 core technologies make building and using components easy

    • Type safety

    • Automatic memory management

    • Metadata

  • This greatly simplifies application development


Type safety

Type Safety

  • Type safety ensures that objects are used the way they were intended to be used

    • Prevents an object’s state from being corrupted

  • The CLR enforces type safety

    • Attempting to coerce an object to an incompatible type causes the CLR to throw an exception

  • Type safety means code confidence

    • Common programmer errors will be found immediately

      Rectangle(hwnd, 0, 0, 10, 10);

      //hwnd should be an hdc

      MessageBox(hwnd, “”, “”, IDOK);

      //IDOK should be MB_OK


Automatic memory management

Automatic Memory Management

  • The CLR tracks the code’s use of objects and ensures

    • Objects are not freed while still in use (no memory corruption)

    • Objects are freed when no longer in use (no memory leaks)

  • Code is easier to write because there is no question as to which component is responsible to free an object

    • When passed a buffer, who frees it: caller or callee?

  • Each process has 1 heap used by all components

    • Objects can’t be allocated from different heaps

    • You don’t have to know which heap memory was allocated in or which API to call to free the memory

      • In fact, there is no API to free memory, the GC does it


Metadata

Metadata

  • Set of data tables embedded in an EXE/DLL

    • The tables describe what is defined in the file (Type, fields, methods, etc.)

  • Every component’s interface is described by metadata tables

    • A component’s implementation is described by Intermediate Language

  • The existence of metadata tables enables many features

    • No header files

    • Visual Studio’s IntelliSense

    • Components don’t have to be registered in the registry

    • Components don’t need separate IDL or TLB files

    • The GC knows when an object’s fields refer to other objects

    • An object’s fields can be automatically serialized/deserialized

    • At runtime, an application can determine what types are in a file and what members the type defines (also known as late binding)

    • Components can be written/used by different languages


Metadata creation and use

Metadata: Creation And Use

Serialization

Reflection

Source

Code

TLB Exporter

Designers

Compiler

Compilers

Debugger

Metadata

(and code)

Type Browser

Profiler

Proxy Generator

Schema

Generator

XML encoding

(SDL or SUDS)


Runtime execution model

Runtime Execution Model

ClassLoader

Assembly

First reference to type

IL to nativeconversion

AssemblyResolver

First reference to Assembly

ManagedNative Code

First callto method

CPU


Jit compiler inline

JIT Compiler - Inline


Standardization

Standardization

  • A subset of the .NET Framework and C# submitted to ECMA

    • ECMA and ISO International Standards

    • Co-sponsored with Intel, Hewlett-Packard

  • Common Language Infrastructure

    • Based on Common Language Runtime and Base Framework

    • Layered into increasing levels of functionality


Rotor sscli

Rotor (SSCLI)

  • Shared-Source version of the CLR+BCL+C# compiler

  • Ports available: Windows, FreeBSD, OSX, etc

  • Real product code offers real world learning

  • http://sscli.org


Developer roadmap

Developer Roadmap

Visual Studio Orcas “Longhorn”

Visual Studio 2005 “Yukon”

  • “Orcas” release

  • Windows “Longhorn” integration

  • New UI tools and designers

  • Extensive managed interfaces

Visual Studio.NET 2003

  • “Whidbey” release

  • SQL Server integration

  • Improved IDE productivity and community support

  • Extended support for XML Web services

  • Office programmability

  • “Everett Release”

  • Windows Server 2003 integration

  • Support for .NET Compact Framework and device development

  • Improved performance


Agenda3

Agenda

  • Part I - Fundamentals

    • Design Goals

    • Architecture

    • CLR Services

  • Part II – Visual Studio 2005

    • Extending the Platform

    • Improving the Platform

    • Innovation in the Platform


Sql server integration design goal

SQL Server IntegrationDesign Goal

  • Bring framework programming model into the database tier

  • Allow business logic to easily migrate to the most appropriate tier

  • Enable safe database extensions

  • Result: Stored Procedures, Triggers, data types defined in managed code


Sql clr functionality

VB, C#, …

Build

Assembly: geom.dll

SQL Data Definition: create assembly … create function … create procedure … create trigger … create type …

SQL Server

SQL Queries: SELECT name FROM Supplier WHERE Location.Distance ( @point ) < 3

SQL CLR Functionality

VS .NET Project

Define Location.Distance()

CLR hosted by SQL (in-proc)


Sql programming model splitting a string

Sql Programming Model Splitting a string

T-SQL

  • The old way….

declare @str varchar(200)

select @Str = 'Microsoft Corporation|SQL Server|2003|SQL-CLR|2002-08-20|11:32:00|Document|3.b.3'

SELECT

substring(@Str + '|', 0 + 1,

charindex('|', @Str + '|', 0 + 1) - 0 - 1 ),

substring(@Str + '|', charindex('|', @Str + '|') + 1,

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) -

charindex('|', @Str + '|') - 1 ),

substring(@Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1,

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) -

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) - 1 ),

substring(@Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1,

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) -

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) - 1 ),

substring(@Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1,

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) -

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) - 1 ),

substring(@Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1,

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) -

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) - 1 ),

substring(@Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1,

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1) -

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) - 1 ),

substring(@Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1) + 1,

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1) + 1) -

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1) - 1 )

declare @str varchar(200)

select @Str = 'Microsoft Corporation|SQL Server|2003|SQL-CLR|2002-08-20|11:32:00|Document|3.b.3'

SELECT

substring(@Str + '|', 0 + 1,

charindex('|', @Str + '|', 0 + 1) - 0 - 1 ),

substring(@Str + '|', charindex('|', @Str + '|') + 1,

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) -

charindex('|', @Str + '|') - 1 ),

substring(@Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1,

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) -

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) - 1 ),

substring(@Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1,

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) -

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) - 1 ),

substring(@Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1,

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) -

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) - 1 ),

substring(@Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1,

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) -

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) - 1 ),

substring(@Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1,

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1) -

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) - 1 ),

substring(@Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1) + 1,

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1) + 1) -

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|',

charindex('|', @Str + '|', charindex('|', @Str + '|',

charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1) - 1 )


Sql programming model splitting a string1

Sql Programming Model Splitting a string

VB

The new way….

Public Shared Sub SplitString()

Dim s As String

s = "Microsoft Corporation|SQL Server|2003|SQL-CLR|2002-08-20|11:32:00|Document|3.b.3"

Dim myArray() As String = Split(s, "|")

End Sub


Moving to 64 bit

Moving to 64 bit

  • 64 bit for Servers and workstations

    • X64 and IA64 bit support

    • Enable Yukon and ASP.NET

  • Verifiable managed binaries just run!

  • VS: Runs as a 32bit application

    • You can develop, deploy, and debug 32 and 64bit applications


Agenda4

Agenda

  • Part I - Fundamentals

    • Design Goals

    • Architecture

    • CLR Services

  • Part II – Visual Studio 2005

    • Extending the Platform

    • Improving the Platform

    • Innovation in the Platform


Performance

Performance

Objectives: make .NET an even greater programming platform

  • Long-Term: make the performance characteristics of the CLR similar to native code

  • Reduce marginal cost of additional managed processes

  • Reduce startup time and working set

    NGen

  • Compiles IL code to native code, saving results to disk

  • Advantages: no need to recompile IL to native code, and class layout already set so better startup time

  • Whidbey: Significant reductions in the amount of private, non-shareable working set

  • OS: ‘no-Jit’ plan, all managed code will be NGened


Performance everywhere

Performance everywhere

New, Performant APIs

  • APIs for faster resource lookup

  • Lightweight CodeGen: only generates essential code (contrast to Reflect Emit)

    Existing APIs Improved

  • Cross AppDomain Remoting

    Between 1.1 and 200x faster. Biggest gains for simpler items (strings, integers, serializable objects)

  • Delegate invoke performance has more than doubled

  • AppDomain Footprints: significantly reduced

  • UTF8Encoding: translation is 2.5x faster


Net framework

TryParse


Rad debugging

RAD Debugging

  • Edit and Continue: Edit Code at runtime

    Allowed Edits: Examples

    • Add private fields to a class

    • Add private non-virtual methods to a class

    • Change a function body, even while stepping

      Disallowed Edits: Examples

    • Removing fields/methods

    • Edits to generic classes

    • Serialization will not recognize new fields

  • Display Attributes for a better debugging experience


Clr security

CLR Security

  • New cryptography support

    • PKI and PKCS7 support

    • XML encryption support

    • Enhanced support for X509 certificates

  • Enhanced Application Security

    • Permission Calculator

      • Integration with ClickOnce

    • Better SecurityException

    • Debug-In-Zone

  • Managed ACL Support


Agenda5

Agenda

  • Part I - Fundamentals

    • Design Goals

    • Architecture

    • CLR Services

  • Part II – Visual Studio 2005

    • Extending the Platform

    • Improving the Platform

    • Innovation in the Platform


Generics

Generics

  • Why generics?

    • Compile-time type checking

    • Performance (no boxing, no downcasts)

    • Reduced code bloat (typed collections)

  • VB, C#, MC++ produce & consume generics

  • Usegenerics freely in internal APIs

  • Consider using generics in public APIs

    • Generics are not yet in CLS

    • To be CLS compliant, provide a non-generic API alternative

  • Microsoft is actively pursuing standardization of generics in runtime and languages


Enhancing the base library other generics to look out for

Enhancing The Base LibraryOther Generics to look out for

  • Nullable(Of T)

    • Extremely useful for situations where null is a value, such as database valuetypes

  • EventHandler<T>

    • Saves on making your own EventHandlers

Dim intVal as Nullable(Of Integer) = 5

If intVal.HasValue Then ‘ checks for a value

delegate voidEventHandler<T>(Object sender, T e) where T : EventArgs;


Whidbey tracing features

Whidbey Tracing Features

Pluggable Formatters

  • Pre-Whidbey : Formatting of Trace information was predefined, and not controllable

  • Whidbey : Predefined formatters (delimiter, xml) added, and you can make your own

    MySource;Error;13;Wrong key;;;;;;318361290184;

    Additional Listeners

  • Pre-Whidbey : No Console listener, ASP had their own tracing mechanism

  • Whidbey : Added Console listener. Integrated ASP tracing into our own, and added ETW listener


Whidbey tracing features1

Whidbey Tracing Features

Auto-generated Data

  • Pre-Whidbey : Standard information such as timestamp or callstack would have to be explicitly generated

  • Whidbey : An Admin can easily generate this data automatically, via config settings

    <listeners>

    <addname="examplelog" type= …

    Simple Thread Identification

  • Pre-Whidbey : specific threads were difficult to identify, and filter on

  • Whidbey : Correlation ID has been added, which allows quick and easy identification of a thread, and simple subsequent filtering


Whidbey tracing features2

Whidbey Tracing Features

Listener Filtering

  • Pre-Whidbey : Formatting of Trace information was predefined, and not controllable

  • Whidbey : Assign filtering to listeners, so only certain messages are traced. This allows filtering on any property of a message. E.g., ID, TimeStamp, etc.

    Switches

  • Pre-Whidbey : Couldn’t determine what tracing a component supported

  • Whidbey : Support the ability to determine what tracing mechanisms a component has


Net framework

Attend a free chat or web cast

http://www.microsoft.com/communities/chats/default.mspx

http://www.microsoft.com/usa/webcasts/default.asp

List of newsgroups

http://communities2.microsoft.com/

communities/newsgroups/en-us/default.aspx

MS Community Sites

http://www.microsoft.com/communities/default.mspx

Local User Groups

http://www.msdnbrasil.com.br

Community sites

http://www.microsoft.com/communities/related/default.mspx


Resources

Resources

  • BCL Blog

    http://weblogs.asp.net/bclteam

  • BCL Website

    http://www.gotdotnet.com/team/clr/bcl/default.aspx

  • BCL public mail alias

    [email protected]

  • Reference

    .NET Framework Standard Library Annotated Reference

    Applied Microsoft .Net Framework Programming


Net framework

Q & A:


Net framework

© 2004 Microsoft Corporation. All rights reserved.

This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.


  • Login