Upload
sarah-merritt
View
229
Download
2
Tags:
Embed Size (px)
Citation preview
.Net Framework.Net Framework
.NET – What Is It?.NET – What Is It?
Software platformSoftware platform
Language neutralLanguage neutral
In other words:In other words: .NET is not a language (Runtime and a .NET is not a language (Runtime and a
library for writing and executing written library for writing and executing written programs in any compliant language)programs in any compliant language)
So what is .NET?So what is .NET?
.NET is a platform that provides a .NET is a platform that provides a standardized set of services.standardized set of services.
It’s just like Windows.It’s just like Windows.
It exports a common interface so that it’s It exports a common interface so that it’s programs can be run on any system that programs can be run on any system that supports .NET.supports .NET.
A specific software frameworkA specific software frameworkIncludes a common runtimeIncludes a common runtime
.NET is a platform that provides a .NET is a platform that provides a standardized set of services.standardized set of services.
It’s just like Windows.It’s just like Windows.
It exports a common interface so that it’s It exports a common interface so that it’s programs can be run on any system that programs can be run on any system that supports .NET.supports .NET.
A specific software frameworkA specific software frameworkIncludes a common runtimeIncludes a common runtime
.NET Framework.NET Framework
Programming model for .NETProgramming model for .NET
Platform for running .NET managed Platform for running .NET managed code in a virtual machinecode in a virtual machine
Provides a very good environment Provides a very good environment to develop networked applications to develop networked applications and Web Servicesand Web Services
Provides programming API and Provides programming API and unified language-independent unified language-independent development frameworkdevelopment framework
Programming model for .NETProgramming model for .NET
Platform for running .NET managed Platform for running .NET managed code in a virtual machinecode in a virtual machine
Provides a very good environment Provides a very good environment to develop networked applications to develop networked applications and Web Servicesand Web Services
Provides programming API and Provides programming API and unified language-independent unified language-independent development frameworkdevelopment framework
.NET Framework – What Is It?.NET Framework – What Is It?
Operating System + HardwareOperating System + Hardware
.NET Framework.NET Framework
.NET Application.NET Application
.Net Framework has four major components.Net Framework has four major components
The Common language RuntimeThe Common language Runtime
Common language specificationsCommon language specifications
The framework class libraryThe framework class library
.Net tools.Net tools
The Core of .NET Framework: CLRThe Core of .NET Framework: CLR
Common Language RuntimeCommon Language RuntimeEXECUTION ENGINEEXECUTION ENGINE
Loads and executes codeLoads and executes code
Convert intermediate language to Convert intermediate language to native machine codenative machine code
Separates processes and memorySeparates processes and memory
Manages memory and objectsManages memory and objects
Code access securityCode access security
Provides code meta data Provides code meta data
DebuggingDebugging
.NET Framework Common Language Runtime.NET Framework Common Language Runtime
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
CLR manages code execution CLR manages code execution at runtimeat runtime
Memory management, thread Memory management, thread management, etc.management, etc.
Architectural OverviewArchitectural Overview
Co
mm
on
Lan
gu
age
Ru
nti
me
Co
mm
on
Lan
gu
age
Ru
nti
me
FrameworkFramework
Class loader and layoutClass loader and layout
code managercode manager
IL t
o
IL t
o
nat
ive
cod
e n
ativ
e co
de
com
pile
rsco
mp
ilers
Sec
uri
tyS
ecu
rity
Exe
cuti
on
Exe
cuti
on
Su
pp
ort
Su
pp
ort
Base ClassesBase Classes
.NET Framework Base Class Library.NET Framework Base Class Library
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
Object-oriented collection of Object-oriented collection of reusable typesreusable types
Collections, I/O, Strings, …Collections, I/O, Strings, …
.NET Framework Data Access Layer.NET Framework Data Access Layer
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
Access relational databasesAccess relational databases
Disconnected data modelDisconnected data model
Work with XMLWork with XML
.NET Framework ASP.NET & Windows Forms.NET Framework ASP.NET & Windows Forms
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
ASP .NETASP .NETWeb Forms Web ServicesWeb Forms Web Services
Mobile Internet ToolkitMobile Internet Toolkit
WindowsWindowsFormsForms
Create application’s front-end – Create application’s front-end – Web-based user interface, Web-based user interface, Windows GUI, Web services, …Windows GUI, Web services, …
.NET Framework Programming Languages.NET Framework Programming Languages
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
ASP .NETASP .NETWeb Forms Web ServicesWeb Forms Web Services
Mobile Internet ToolkitMobile Internet Toolkit
WindowsWindowsFormsForms
C++C++ C#C# VB.NETVB.NET PerlPerl J#J# ……
Use your favorite languageUse your favorite language
.NET Framework Common Language Specification.NET Framework Common Language Specification
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
ASP .NETASP .NETWeb Forms Web ServicesWeb Forms Web Services
Mobile Internet ToolkitMobile Internet Toolkit
WindowsWindowsFormsForms
Common Language SpecificationCommon Language SpecificationC++C++ C#C# VBVB PerlPerl J#J# ……
.NET Framework Visual Studio .NET.NET Framework Visual Studio .NET
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
ASP .NETASP .NETWeb Forms Web ServicesWeb Forms Web Services
Mobile Internet ToolkitMobile Internet Toolkit
WindowsWindowsFormsForms
Common Language SpecificationCommon Language Specification
C++C++ C#C# VBVB PerlPerl J#J# ……
Visu
al S
tud
io .N
ET
Visu
al S
tud
io .N
ET
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
ASP .NETASP .NETWeb Services Web FormsWeb Services Web Forms
Mobile Internet ToolkitMobile Internet Toolkit
WindowsWindowsFormsForms
Common Language SpecificationCommon Language Specification
C++C++ C#C# VBVB PerlPerl J#J# ……
Visu
al S
tud
io .N
ET
Visu
al S
tud
io .N
ET
Open LanguageOpen LanguageSpecificationSpecification
C# Language – C# Language – Submitted to ECMASubmitted to ECMA
XML-basedXML-baseddata accessdata access
Web services –Web services –XML, SOAP-basedXML, SOAP-based
.NET Framework Standards Compliance.NET Framework Standards Compliance
Common Language RuntimeCommon Language Runtime
Manages running code – like a virtual Manages running code – like a virtual machinemachine
ThreadingThreadingMemory managementMemory managementNo interpreter: JIT-compiler produces No interpreter: JIT-compiler produces native code – during the program native code – during the program installation or at run timeinstallation or at run time
Fine-grained evidence-based securityFine-grained evidence-based securityCode access securityCode access security
Code can be verified to guarantee type safetyCode can be verified to guarantee type safetyNo unsafe casts, no un-initialized variables No unsafe casts, no un-initialized variables and no out-of-bounds array indexingand no out-of-bounds array indexing
Role-based securityRole-based security
Manages running code – like a virtual Manages running code – like a virtual machinemachine
ThreadingThreadingMemory managementMemory managementNo interpreter: JIT-compiler produces No interpreter: JIT-compiler produces native code – during the program native code – during the program installation or at run timeinstallation or at run time
Fine-grained evidence-based securityFine-grained evidence-based securityCode access securityCode access security
Code can be verified to guarantee type safetyCode can be verified to guarantee type safetyNo unsafe casts, no un-initialized variables No unsafe casts, no un-initialized variables and no out-of-bounds array indexingand no out-of-bounds array indexing
Role-based securityRole-based security
Managed CodeManaged Code
Code that targets the CLR is referred to Code that targets the CLR is referred to as managed codeas managed codeAll managed code has the features of All managed code has the features of the CLRthe CLR
Object-orientedObject-orientedType-safeType-safeCross-language integrationCross-language integrationCross language exception handlingCross language exception handlingMultiple version supportMultiple version support
Managed code is represented in special Managed code is represented in special Intermediate Language (IL)Intermediate Language (IL)
Automatic Memory ManagementAutomatic Memory Management
The CLR manages memory for managed codeThe CLR manages memory for managed codeAll allocations of objects and buffers made from All allocations of objects and buffers made from a a Managed HeapManaged Heap
Unused objects and buffers are cleaned up Unused objects and buffers are cleaned up automatically through automatically through Garbage CollectionGarbage Collection
Intermediate LanguageIntermediate Language
.NET languages are compiled to an .NET languages are compiled to an Intermediate Language (IL)Intermediate Language (IL)
IL is also known as MSIL or CILIL is also known as MSIL or CIL
CLR compiles IL in just-in-time (JIT) CLR compiles IL in just-in-time (JIT) manner – each function is compiled manner – each function is compiled just before executionjust before execution
The JIT code stays in memory for The JIT code stays in memory for subsequent callssubsequent calls
Recompilations of assemblies are Recompilations of assemblies are also possiblealso possible
Example of MSIL CodeExample of MSIL Code
.method private hidebysig static void Main() .method private hidebysig static void Main() cil managedcil managed
{{ .entrypoint.entrypoint // Code size 11 (0xb)// Code size 11 (0xb) .maxstack 8.maxstack 8 IL_0000: ldstr "Hello, world!"IL_0000: ldstr "Hello, world!" IL_0005: call void IL_0005: call void
[mscorlib]System.Console::WriteLine(string)[mscorlib]System.Console::WriteLine(string) IL_000a: retIL_000a: ret} // end of method HelloWorld::Main} // end of method HelloWorld::Main
Common Type System (CTS)Common Type System (CTS)
All .NET languages have the same primitive All .NET languages have the same primitive data types. An data types. An intint in C# is the same as an in C# is the same as an intint in VB.NETin VB.NETWhen communicating between modules When communicating between modules written in any .NET language, the types are written in any .NET language, the types are guaranteed to be compatible on the binary guaranteed to be compatible on the binary levellevelTypes can be:Types can be:
Value types – passed by value, stored in the Value types – passed by value, stored in the stackstackReference types – passed by reference, stored Reference types – passed by reference, stored in the heapin the heap
Common Language Specification (CLS)Common Language Specification (CLS)
Any language that conforms to the CLS Any language that conforms to the CLS is a .NET languageis a .NET language
A language that conforms to the CLS A language that conforms to the CLS has the ability to take full advantage of has the ability to take full advantage of the Framework Class Library (FCL)the Framework Class Library (FCL)
CLS is standardized by ECMACLS is standardized by ECMA
.NET Languages.NET Languages
Languages provided by MicrosoftLanguages provided by MicrosoftC++, C#, J#, VB.NET, C++, C#, J#, VB.NET, JScriptJScript
Third-parties languagesThird-parties languagesPerl, Python, Pascal, APL, COBOL, Eiffel, Perl, Python, Pascal, APL, COBOL, Eiffel, Haskell, ML, Oberon, Scheme, Smalltalk…Haskell, ML, Oberon, Scheme, Smalltalk…
Advanced multi-language featuresAdvanced multi-language featuresCross-language inheritance and Cross-language inheritance and exceptions handlingexceptions handling
C# LanguageC# Language
Mixture between C++, Java Mixture between C++, Java Component-orientedComponent-oriented
Properties, Methods, EventsProperties, Methods, EventsAttributes, XML documentationAttributes, XML documentationAll in one place, no header files, IDL, etc.All in one place, no header files, IDL, etc.Can be embedded in ASP+ pagesCan be embedded in ASP+ pages
Everything really is an objectEverything really is an objectPrimitive typesPrimitive types
C# Language – ExampleC# Language – Example
using System;using System;
class HelloWorldclass HelloWorld{{
public static void main()public static void main(){{
Console.WriteLine(“Hello, Console.WriteLine(“Hello, world!”);world!”);}}
}}
Code Compilation and ExecutionCode Compilation and Execution
CompilationCompilation
Before Before installation or installation or the first time the first time
each method is each method is calledcalled
Before Before installation or installation or the first time the first time
each method is each method is calledcalledExecutionExecution
JIT JIT CompilerCompiler
NativeNativeCodeCode
MSILMSILCodeCode
MetadataMetadata
Source Source CodeCode
Language Language CompilerCompiler
Also called Also called AssemblyAssembly(.EXE or(.EXE or.DLL file).DLL file)
Also called Also called AssemblyAssembly(.EXE or(.EXE or.DLL file).DLL file)
AssembliesAssembliesLogical unit of code Logical unit of code
Contains the code that CLR executesContains the code that CLR executes
DLL or EXE fileDLL or EXE file
Smallest deployable unit in the CLRSmallest deployable unit in the CLR
Have unique version numberHave unique version number
No version conflicts (known as DLL hell)No version conflicts (known as DLL hell)
Contains IL code to be executedContains IL code to be executed
Security boundary – permissions are Security boundary – permissions are granted at the assembly levelgranted at the assembly level
Type boundary – all types include the Type boundary – all types include the assembly name they are a part ofassembly name they are a part of
Self-describing manifest – metadata that Self-describing manifest – metadata that describes the types in the assemblydescribes the types in the assembly
Metadata in AssemblyMetadata in Assembly
Type DescriptionsType Descriptions
ClassesClassesBase classesBase classesImplemented interfacesImplemented interfacesData membersData membersMethodsMethods
ClassesClassesBase classesBase classesImplemented interfacesImplemented interfacesData membersData membersMethodsMethods
NameNameVersionVersionCultureCulture
NameNameVersionVersionCultureCulture
Assembly DescriptionAssembly Description
Other assembliesOther assembliesSecurity PermissionsSecurity PermissionsExported TypesExported Types
Other assembliesOther assembliesSecurity PermissionsSecurity PermissionsExported TypesExported Types
ApplicationsApplications
One or more assembliesOne or more assemblies
Assemblies conflict resolutionAssemblies conflict resolution
AssemblyAssemblyPrivate(direct)Private(direct)
Shared(reference)Shared(reference)
Using metadataUsing metadataLocal (preferred)Local (preferred)
Global Assembly Cache (GAC)Global Assembly Cache (GAC)
..
..
Different applications may use different versions of an assembly
Easier software updatesEasier software removal
Visual Studio .NETVisual Studio .NET
Development tool that contains a rich set of Development tool that contains a rich set of productivity and debugging featuresproductivity and debugging features
Supports managed and unmanaged applicationsSupports managed and unmanaged applications
Supports C#, C++, VB.NET, …Supports C#, C++, VB.NET, …
Many useful tools and wizardsMany useful tools and wizards
Windows Forms DesignerWindows Forms Designer
ASP.NET Web Forms DesignerASP.NET Web Forms Designer
Web Services supportWeb Services support
SQL Server integration with ADO.NET and XMLSQL Server integration with ADO.NET and XML
VS.NET – Single Development Environment & Skill SetVS.NET – Single Development Environment & Skill Set
From Visual Studio.NET you can:From Visual Studio.NET you can:Write codeWrite code
Design user interfaceDesign user interface
Study documentationStudy documentation
DebugDebug
TestTest
DeployDeploy
Same tools for all languagesSame tools for all languages
Same tools for all platformsSame tools for all platforms
The .NET Framework LibraryThe .NET Framework Library
Base Class LibraryBase Class Library
ADO.NET and XMLADO.NET and XML
Web Forms Web ServicesWeb Forms Web ServicesMobile Internet ToolkitMobile Internet Toolkit
WindowsWindowsFormsForms
ASP.NETASP.NET
System System
GlobalizationGlobalization
DiagnosticsDiagnostics
ConfigurationConfiguration
CollectionsCollections
ResourcesResources
ReflectionReflection
NetNet
IOIO
ThreadingThreading
TextText
ServiceProcessServiceProcess
SecuritySecurity RuntimeRuntimeInteropServicesInteropServices
RemotingRemoting
SerializationSerialization
System.DataSystem.Data
DesignDesign
ADOADO
SQLTypesSQLTypes
SQLSQL
System.XmlSystem.Xml
XPathXPath
XSLTXSLT SerializationSerialization
System.WebSystem.Web
ConfigurationConfiguration SessionStateSessionState
CachingCaching SecuritySecurity
ServicesServices UIUIHtmlControlsHtmlControls
WebControlsWebControls
DescriptionDescription
DiscoveryDiscovery
ProtocolsProtocols System.DrawingSystem.Drawing
ImagingImaging
Drawing2DDrawing2D
TextText
PrintingPrinting
System.WinFormsSystem.WinForms
DesignDesign ComponentModelComponentModel
.NET Framework Namespaces.NET Framework Namespaces
Base Class Library NamespacesBase Class Library Namespaces
SystemSystem
ThreadingThreading
TextText
ServiceProcessServiceProcess
SecuritySecurity
ResourcesResources
ReflectionReflection
NetNet
IOIO
GlobalizationGlobalization
DiagnosticsDiagnostics
ConfigurationConfiguration
CollectionsCollections
RuntimeRuntime
SerializationSerialization
RemotingRemoting
InteropServicesInteropServices
Base Class LibraryBase Class Library
Data types, conversions, formattingData types, conversions, formatting
Collections: Collections: ArrayList, HashtableArrayList, Hashtable, etc., etc.
Globalization: Cultures, sorting, etc.Globalization: Cultures, sorting, etc.
I/O: Binary and text streams, files, etc.I/O: Binary and text streams, files, etc.
Networking: HTTP, TCP/IP sockets, etc.Networking: HTTP, TCP/IP sockets, etc.
Reflection: Metadata and IL emitReflection: Metadata and IL emit
Security: Permissions, cryptographySecurity: Permissions, cryptography
Text: Encodings, regular expressionsText: Encodings, regular expressions
Data And XML NamespacesData And XML Namespaces
System.DataSystem.Data
SQLTypesSQLTypes
SQLClientSQLClient
CommonCommon
OleDbOleDb
System.XmlSystem.Xml
SerializationSerialization
XPathXPath
XSLTXSLT
ADO.NET And XMLADO.NET And XML
ADO.NET consumes all types of dataADO.NET consumes all types of dataXML (hierarchical), relational, etc.XML (hierarchical), relational, etc.
Powerful in-memory data cache (DataSet)Powerful in-memory data cache (DataSet)DataSet contains various data objects: DataSet contains various data objects: tables, views, relations, constraints, etc.tables, views, relations, constraints, etc.Lightweight, stateless, disconnectedLightweight, stateless, disconnectedSupports both relational and XML accessSupports both relational and XML access
High-performance, low overhead stream High-performance, low overhead stream accessaccessGreat XML support including: Great XML support including:
W3C DOM, XSL/T, XPath, and SchemaW3C DOM, XSL/T, XPath, and Schema
Windows Forms NamespacesWindows Forms Namespaces
System.DrawingSystem.Drawing
Drawing2DDrawing2D
ImagingImaging
PrintingPrinting
TextText
System.Windows.FormsSystem.Windows.Forms
DesignDesign ComponentModelComponentModel
Windows FormsWindows Forms
Windows Forms is framework for building rich GUI applications
RAD (Rapid Application Development)component-basedevent-driven
Rich set of controlsData aware componentsActiveX® SupportPrinting supportUnicode supportUI inheritance
Windows FormsWindows Forms
Combines VB and Delphi forms with the Combines VB and Delphi forms with the power of MFCpower of MFC
Delegation as well as subclassingDelegation as well as subclassing
Advanced featuresAdvanced featuresVisual forms inheritance, automatic layoutVisual forms inheritance, automatic layoutAdvanced graphics support – GDI+Advanced graphics support – GDI+Easy access to Win32Easy access to Win32®® API API
Controls can be hosted in IE 5.xControls can be hosted in IE 5.xNo installation, registration or No installation, registration or GUIDsGUIDs
Code access securityCode access security
VS.NET – Windows Forms DesignerVS.NET – Windows Forms Designer
DemoDemo
Create simple database Create simple database application with:application with:
Windows FormsWindows Forms
ADO.NETADO.NET
MS SQL ServerMS SQL Server
Visual Studio .NETVisual Studio .NET
ASP.NET NamespacesASP.NET Namespaces
System.WebSystem.Web
CachingCaching
ConfigurationConfiguration
ServicesServices UIUI
SessionStateSessionState
HtmlControlsHtmlControls
WebControlsWebControls
DescriptionDescription
DiscoveryDiscovery
SecuritySecurity
ProtocolsProtocols
Framework for building Web applications and Framework for building Web applications and Web services in any .NET languageWeb services in any .NET language
C#, C++, VB.NET, C#, C++, VB.NET, JScriptJScript, etc., etc.
Automatic multiple clients supportAutomatic multiple clients supportDHTML, HTML 3.2, WML, small devicesDHTML, HTML 3.2, WML, small devices
Compilation of ASP.NET Web applications Compilation of ASP.NET Web applications into .NET assembliesinto .NET assemblies
Cached the first time when calledCached the first time when called
All subsequent calls use the cached versionAll subsequent calls use the cached version
Separation of code and contentSeparation of code and contentDevelopers and designers can work independentlyDevelopers and designers can work independently
ASP.NETASP.NET
ASP.NETASP.NET
Rich page architecture – “Web Forms”Rich page architecture – “Web Forms”
Rich set of ASP.NET server controlsRich set of ASP.NET server controlsData validationData validation
Data bound gridsData bound grids
Event-driven execution modelEvent-driven execution model
Great Web-services supportGreat Web-services support
Easy to deployEasy to deploy
High reliability and availabilityHigh reliability and availability
High performance and scalabilityHigh performance and scalability
Scalable handling of state informationScalable handling of state information
VS.NET – Web Forms DesignerVS.NET – Web Forms Designer
DemoDemo
Create simple Web-based Create simple Web-based database application with:database application with:
ASP.NET (Web Forms)ASP.NET (Web Forms)
ADO.NETADO.NET
MS SQL ServerMS SQL Server
Visual Studio .NETVisual Studio .NET
Web ServicesWeb Services
Technical definition – “A programmable Technical definition – “A programmable application component accessible via application component accessible via standard Web protocols”standard Web protocols”
Built on XML and SOAPBuilt on XML and SOAP
Expose functionality from Web SitesExpose functionality from Web SitesAlmost like component programming over Almost like component programming over the Webthe WebFunctionality exposed using XML/HTMLFunctionality exposed using XML/HTML
Standard Web Services includeStandard Web Services includeCalendarCalendar
XML Web Services FoundationXML Web Services Foundation
Ubiquitous Communications: InternetUbiquitous Communications: Internet
Universal Data Format:Universal Data Format: XMLXML
Service Interactions:Service Interactions: SOAPSOAP
Publish, Find, Use Services:Publish, Find, Use Services: UDDIUDDI
Simple, Open, Broad Industry SupportSimple, Open, Broad Industry Support
Open standards:Open standards:
ASP.NET Web ServicesASP.NET Web Services
Simple programming modelSimple programming modelAuthor .ASMX files with class methodsAuthor .ASMX files with class methods
ASP.NET compiles on demand, generates ASP.NET compiles on demand, generates WSDL contract, exposes HTML test pageWSDL contract, exposes HTML test page
Incoming HTTP/SOAP messages invoke Incoming HTTP/SOAP messages invoke methodsmethods
No special HTTP, SOAP or XML knowledge No special HTTP, SOAP or XML knowledge requiredrequired
Supports multiple message wire formatsSupports multiple message wire formatsHTTP GET, POST, and SOAP RequestsHTTP GET, POST, and SOAP Requests
Web Service Example in C#Web Service Example in C#
ParcelTracker.asmxParcelTracker.asmx ParcelTracker.asmxParcelTracker.asmx
<%@ WebService Language="C#" %><%@ WebService Language="C#" %>using System;using System;using System.Web.Services;using System.Web.Services;
public class ParcelTrackerWebServicepublic class ParcelTrackerWebService{{ [WebMethod][WebMethod] public string GetOrderStatus(int orderNumber)public string GetOrderStatus(int orderNumber) {{ //// Implementation hereImplementation here }}}}
<%@ WebService Language="C#" %><%@ WebService Language="C#" %>using System;using System;using System.Web.Services;using System.Web.Services;
public class ParcelTrackerWebServicepublic class ParcelTrackerWebService{{ [WebMethod][WebMethod] public string GetOrderStatus(int orderNumber)public string GetOrderStatus(int orderNumber) {{ //// Implementation hereImplementation here }}}}
.NET Framework on Linux.NET Framework on Linux
Mono ProjectMono ProjectOpen Source C# compiler, CLR and Framework Open Source C# compiler, CLR and Framework Class LibraryClass Library
Runs on various platforms and hardware:Runs on various platforms and hardware:
Linux, Unix, FreeBSD, Windows – JIT-Linux, Unix, FreeBSD, Windows – JIT-compiler for x86compiler for x86
s390, SPARCs390, SPARC,, PowerPC PowerPC – interpreter for these – interpreter for these hardware architectureshardware architectures
Supports also:Supports also:
ADO.NET and XMLADO.NET and XML
Windows Forms (not fully)Windows Forms (not fully)
ASP.NETASP.NET
Web ServicesWeb Services
.NET Framework on Linux (2).NET Framework on Linux (2)Mono ProjectMono Project
Runs .NET portable executables on Linux, e.g.Runs .NET portable executables on Linux, e.g.mono myapp.exemono myapp.exe
Compiles .NET applications to portable Compiles .NET applications to portable executables, e.g.executables, e.g.
mcs myapp.csmcs myapp.cs
The obtained .exe file can taken and run on The obtained .exe file can taken and run on WindowsWindows
DotGNU Portable.NETDotGNU Portable.NET
Build and execute .NET applications on Build and execute .NET applications on GNU/LinuxGNU/Linux, , Windows, Solaris, NetBSD, FreeBSD, Windows, Solaris, NetBSD, FreeBSD, and MacOS X and MacOS X
SummarySummary
.NET Framework is a code execution platform .NET Framework is a code execution platform – the environment which .NET programs run– the environment which .NET programs run
.NET Framework consists of two primary .NET Framework consists of two primary parts: Common Language Runtime and .NET parts: Common Language Runtime and .NET Class LibrariesClass Libraries
The CLS (Common Language Specification) The CLS (Common Language Specification) allows different languages to interact allows different languages to interact seamlessly.seamlessly.
The CTS (Common Type System) allows all The CTS (Common Type System) allows all languages to share base data types.languages to share base data types.
Summary (2)Summary (2)
.NET languages are compiled to MSIL by .NET languages are compiled to MSIL by their respective compilerstheir respective compilers
MSIL code is compiled to machine code by MSIL code is compiled to machine code by the JIT compilerthe JIT compiler
All .NET languages have equal access to the All .NET languages have equal access to the FCL (Framework Class Library) which is a FCL (Framework Class Library) which is a rich set of classes for developing softwarerich set of classes for developing software
Base Class Library is set of basic classes: Base Class Library is set of basic classes: Collections, I/O, Networking, Security, etc.Collections, I/O, Networking, Security, etc.
ADO.NET provides .NET applications with ADO.NET provides .NET applications with access to relational databasesaccess to relational databases
Summary (3)Summary (3)
.NET has great XML support including: DOM, .NET has great XML support including: DOM, XSLT, XSLT, XPathXPath, and , and XSchemaXSchema
Windows Forms provides GUI interface for Windows Forms provides GUI interface for the .NET applicationsthe .NET applications
ASP.NET allows creating web interface ASP.NET allows creating web interface to .NET applicationsto .NET applications
Web Services expose functionality from web Web Services expose functionality from web sites and make it remotely accessible sites and make it remotely accessible through standard XML-based protocolsthrough standard XML-based protocols
Visual Studio .NET is powerful development Visual Studio .NET is powerful development IDE for all .NET languages and technologiesIDE for all .NET languages and technologies
.NET Framework – Resources.NET Framework – ResourcesVisit following web sites:Visit following web sites:
..NET Framework Home Site – NET Framework Home Site – http://msdn.microsoft.com/netframework/http://msdn.microsoft.com/netframework/The Microsoft .NET Framework Community – The Microsoft .NET Framework Community – http://www.gotdotnet.com/http://www.gotdotnet.com/ASP.NET – ASP.NET – http://www.asp.net/http://www.asp.net/.NET Windows Forms – .NET Windows Forms – http://www.windowsforms.net/http://www.windowsforms.net/Code Project – http://www.codeproject.net/Code Project – http://www.codeproject.net/Mono – Open Source .NET Framework – Mono – Open Source .NET Framework – http://www.go-mono.org/http://www.go-mono.org/Rotor – Shared Source .NET CLI – Rotor – Shared Source .NET CLI – http://msdn.microsoft.com/net/sscli/http://msdn.microsoft.com/net/sscli/
Read the news groups:Read the news groups:news://news://msnews.microsoft.commsnews.microsoft.com//microsoft.public.dotnet.frameworkmicrosoft.public.dotnet.framework
Questions?Questions?
AgendaAgenda
Part I - FundamentalsPart I - FundamentalsProgramming ModelsProgramming Models
Design Goals and ArchitectureDesign Goals and Architecture
CLR ServicesCLR Services
Part II – Visual Studio 2005Part II – Visual Studio 2005Extending the PlatformExtending the Platform
Improving the PlatformImproving the Platform
Innovation in the PlatformInnovation in the Platform
Unify Programming ModelsUnify Programming Models
Windows APIWindows API
.NET Framework.NET Framework
Consistent API availability regardless ofConsistent API availability regardless oflanguage and programming modellanguage and programming model
ASPASP
Stateless,Stateless,Code embeddedCode embeddedin HTML pagesin HTML pages
MFC/ATLMFC/ATL
Subclassing,Subclassing,Power,Power,
ExpressivenessExpressiveness
VB FormsVB Forms
RAD,RAD,Composition,Composition,
DelegationDelegation
Make It Simple To UseMake It Simple To Use
OrganizationOrganizationCode organized in hierarchical Code organized in hierarchical namespaces and classesnamespaces and classes
Unified type systemUnified type systemEverything is an object, no variants, one Everything is an object, no variants, one string type, all character data is Unicodestring type, all character data is Unicode
Component OrientedComponent OrientedProperties, methods, events, and attributes Properties, methods, events, and attributes are first class constructsare first class constructs
Design-time functionalityDesign-time functionality
How Much Simpler?How Much Simpler?
HWND hwndMain = CreateWindowEx(HWND hwndMain = CreateWindowEx( 0, "MainWClass", "Main Window",0, "MainWClass", "Main Window", WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL,WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, CW_USEDEFAULT, CW_USEDEFAULT,CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,CW_USEDEFAULT, CW_USEDEFAULT, (HWND)NULL, (HMENU)NULL, hInstance, NULL); (HWND)NULL, (HMENU)NULL, hInstance, NULL); ShowWindow(hwndMain, SW_SHOWDEFAULT); ShowWindow(hwndMain, SW_SHOWDEFAULT); UpdateWindow(hwndMain);UpdateWindow(hwndMain);
Form form = new Form();Form form = new Form();form.Text = "Main Window";form.Text = "Main Window";form.Show();form.Show();
Windows APIWindows API
.NET Framework.NET Framework
Hello World DemoHello World Demo
What you needWhat you need
AgendaAgenda
Part I - FundamentalsPart I - FundamentalsProgramming ModelsProgramming Models
Design Goals and ArchitectureDesign Goals and Architecture
CLR ServicesCLR Services
Part II – Visual Studio 2005Part II – Visual Studio 2005Extending the PlatformExtending the Platform
Improving the PlatformImproving the Platform
Innovation in the PlatformInnovation in the Platform
Common Language RuntimeDesign GoalsCommon Language RuntimeDesign Goals
Dramatically simplifies development Dramatically simplifies development and deploymentand deployment
Unifies programming modelsUnifies programming models
Provides robust and secure execution Provides robust and secure execution environmentenvironment
Supports multiple programming Supports multiple programming languageslanguages
AssemblyAssembly
Compilation And ExecutionCompilation And Execution
Source Source CodeCode
Language Language CompilerCompiler
CompilationCompilation
At installation or the At installation or the first time each first time each
method is calledmethod is calledExecutionExecution
JIT JIT CompilerCompiler
NativeNative
CodeCode
Code (IL)Code (IL)
MetadataMetadata
LanguagesLanguages
The CLR is Language NeutralThe CLR is Language NeutralAll languages are first class playersAll languages are first class players
You can leverage your existing skillsYou can leverage your existing skills
Common Language SpecificationCommon Language SpecificationSet of features guaranteed to be in all Set of features guaranteed to be in all languageslanguages
We are providingWe are providingVB, C++, C#, J#, JScriptVB, C++, C#, J#, JScript
Third-parties are buildingThird-parties are buildingAPL, COBOL, Pascal, Eiffel, Haskell, ML, APL, COBOL, Pascal, Eiffel, Haskell, ML, Oberon, Perl, Python, Scheme, Smalltalk…Oberon, Perl, Python, Scheme, Smalltalk…
Hello World DemoHello World Demo
What you needWhat you need
MSILMSIL
AgendaAgenda
Part I - FundamentalsPart I - FundamentalsProgramming ModelsProgramming Models
Design Goals and ArchitectureDesign Goals and Architecture
CLR ServicesCLR Services
Part II – Visual Studio 2005Part II – Visual Studio 2005Extending the PlatformExtending the Platform
Improving the PlatformImproving the Platform
Innovation in the PlatformInnovation in the Platform
Component-Based ProgrammingComponent-Based Programming
3 core technologies make building and 3 core technologies make building and using components easyusing components easy
Type safetyType safety
Automatic memory managementAutomatic memory management
MetadataMetadata
This greatly simplifies application This greatly simplifies application developmentdevelopment
Type SafetyType Safety
Type safety ensures that objects are used Type safety ensures that objects are used the way they were intended to be usedthe way they were intended to be used
Prevents an object’s state from being corruptedPrevents an object’s state from being corrupted
The CLR enforces type safetyThe CLR enforces type safetyAttempting to coerce an object to an Attempting to coerce an object to an incompatible type causes the CLR to throw an incompatible type causes the CLR to throw an exceptionexception
Type safety means code confidenceType safety means code confidenceCommon programmer errors will be found Common programmer errors will be found immediatelyimmediatelyRectangle(hwnd, 0, 0, 10, 10);Rectangle(hwnd, 0, 0, 10, 10);
//hwnd should be an hdc//hwnd should be an hdc
MessageBox(hwnd, “”, “”, IDOK);MessageBox(hwnd, “”, “”, IDOK);
//IDOK should be MB_OK//IDOK should be MB_OK
Automatic Memory ManagementAutomatic Memory Management
The CLR tracks the code’s use of objects and The CLR tracks the code’s use of objects and ensuresensures
Objects are not freed while still in use (no memory Objects are not freed while still in use (no memory corruption)corruption)
Objects are freed when no longer in use (no memory leaks)Objects are freed when no longer in use (no memory leaks)
Code is easier to write because there is no question Code is easier to write because there is no question as to which component is responsible to free an as to which component is responsible to free an objectobject
When passed a buffer, who frees it: caller or callee?When passed a buffer, who frees it: caller or callee?
Each process has 1 heap used by all componentsEach process has 1 heap used by all componentsObjects can’t be allocated from different heapsObjects can’t be allocated from different heaps
You don’t have to know which heap memory was allocated You don’t have to know which heap memory was allocated in or which API to call to free the memoryin or which API to call to free the memory
In fact, there is no API to free memory, the GC does itIn fact, there is no API to free memory, the GC does it
MetadataMetadata
Set of data tables embedded in an EXE/DLLSet of data tables embedded in an EXE/DLLThe tables describe what is defined in the file (Type, fields, The tables describe what is defined in the file (Type, fields, methods, etc.)methods, etc.)
Every component’s interface is described by metadata tablesEvery component’s interface is described by metadata tablesA component’s implementation is described by Intermediate A component’s implementation is described by Intermediate LanguageLanguage
The existence of metadata tables enables many featuresThe existence of metadata tables enables many featuresNo header filesNo header files
Visual Studio’s IntelliSenseVisual Studio’s IntelliSense
Components don’t have to be registered in the registryComponents don’t have to be registered in the registry
Components don’t need separate IDL or TLB filesComponents don’t need separate IDL or TLB files
The GC knows when an object’s fields refer to other objectsThe GC knows when an object’s fields refer to other objects
An object’s fields can be automatically serialized/deserializedAn object’s fields can be automatically serialized/deserialized
At runtime, an application can determine what types are in a file At runtime, an application can determine what types are in a file and what members the type defines (also known as late binding)and what members the type defines (also known as late binding)
Components can be written/used by different languagesComponents can be written/used by different languages
Metadata: Creation And UseMetadata: Creation And Use
MetadataMetadata(and code)(and code)
DebuggerDebugger
Schema Schema GeneratorGenerator
ProfilerProfiler
CompilersCompilers
Proxy GeneratorProxy Generator
Type BrowserType Browser
CompilerCompiler
SourceSourceCodeCode
XML encodingXML encoding(SDL or SUDS)(SDL or SUDS)
SerializationSerialization
DesignersDesigners
ReflectionReflection
TLB ExporterTLB Exporter
Runtime Execution ModelRuntime Execution Model
ClassClassLoaderLoader
CPUCPU
ManagedManagedNative CodeNative Code
AssemblyAssembly
First callFirst callto methodto method
First reference First reference to to typetype
AssemblyAssemblyResolverResolver
First reference First reference to Assemblyto Assembly
IL to nativeIL to nativeconversionconversion
JIT Compiler - InlineJIT Compiler - Inline
StandardizationStandardization
A subset of the .NET Framework and C# A subset of the .NET Framework and C# submitted to ECMAsubmitted to ECMA
ECMA and ISO International StandardsECMA and ISO International Standards
Co-sponsored with Intel, Hewlett-PackardCo-sponsored with Intel, Hewlett-Packard
Common Language InfrastructureCommon Language InfrastructureBased on Common Language Runtime and Based on Common Language Runtime and Base FrameworkBase Framework
Layered into increasing levels of Layered into increasing levels of functionalityfunctionality
Rotor (SSCLI) Rotor (SSCLI)
Shared-Source version of the Shared-Source version of the CLR+BCL+C# compilerCLR+BCL+C# compiler
Ports available: Windows, FreeBSD, Ports available: Windows, FreeBSD, OSX, etcOSX, etc
Real product code offers real world Real product code offers real world learning learning
http://sscli.org http://sscli.org
Developer RoadmapDeveloper Roadmap
• “ “Orcas” releaseOrcas” release
• Windows “Longhorn” Windows “Longhorn” integrationintegration
• New UI tools and New UI tools and designers designers
• Extensive managed Extensive managed interfacesinterfaces
Visual Studio Visual Studio Orcas Orcas
“Longhorn”“Longhorn”
Visual StudioVisual Studio.NET 2003.NET 2003
• “ “Everett Release”Everett Release”
• Windows Server 2003 Windows Server 2003 integrationintegration
• Support for .NET Support for .NET Compact Framework Compact Framework and device and device development development
• Improved performanceImproved performance
Visual Studio 2005 Visual Studio 2005 “Yukon”“Yukon”
• “ “Whidbey” releaseWhidbey” release
• SQL Server SQL Server integrationintegration
• Improved IDE Improved IDE productivity and productivity and community supportcommunity support
• Extended support for Extended support for XML Web servicesXML Web services
• Office Office programmabilityprogrammability
AgendaAgenda
Part I - FundamentalsPart I - FundamentalsDesign Goals Design Goals
ArchitectureArchitecture
CLR ServicesCLR Services
Part II – Visual Studio 2005Part II – Visual Studio 2005Extending the PlatformExtending the Platform
Improving the PlatformImproving the Platform
Innovation in the PlatformInnovation in the Platform
SQL Server IntegrationDesign GoalSQL Server IntegrationDesign Goal
Bring framework programming model Bring framework programming model into the database tierinto the database tier
Allow business logic to easily migrate Allow business logic to easily migrate to the most appropriate tierto the most appropriate tier
Enable Enable safe safe database extensionsdatabase extensions
Result: Stored Procedures, Triggers, Result: Stored Procedures, Triggers, data types defined in managed codedata types defined in managed code
VS .NET VS .NET ProjectProject
Assembly: geom.dll
VB, C#, …VB, C#, … BuildBuild
SQL ServerSQL Server
SQL Data Definition: SQL Data Definition: create create assembly … assembly … create function … create function … create create procedure … procedure … create trigger … create trigger … create create type …type …SQL Queries: SQL Queries:
SELECT name FROM Supplier SELECT name FROM Supplier WHERE Location.Distance ( @point ) < 3WHERE Location.Distance ( @point ) < 3
CLR hosted by SQL (in-proc)
SQL CLR Functionality SQL CLR Functionality
Define Location.Distance()
Sql Programming Model Splitting a stringSql Programming Model Splitting a string
The old way…. The old way…. declare @str varchar(200)declare @str varchar(200)select @Str = 'Microsoft Corporation|SQL Server|2003|select @Str = 'Microsoft Corporation|SQL Server|2003|SQL-CLR|2002-08-20|11:32:00|Document|3.b.3'SQL-CLR|2002-08-20|11:32:00|Document|3.b.3'SELECTSELECTsubstring(@Str + '|', 0 + 1, substring(@Str + '|', 0 + 1, charindex('|', @Str + '|', 0 + 1) - 0 - 1 ),charindex('|', @Str + '|', 0 + 1) - 0 - 1 ),substring(@Str + '|', charindex('|', @Str + '|') + 1, substring(@Str + '|', charindex('|', @Str + '|') + 1, charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) - charindex('|', @Str + '|') + 1) - charindex('|', @Str + '|') - 1 ),charindex('|', @Str + '|') - 1 ),substring(@Str + '|', charindex('|', @Str + '|', substring(@Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1,charindex('|', @Str + '|') + 1) + 1, charindex('|', @Str + '|', charindex('|', @Str + charindex('|', @Str + '|', charindex('|', @Str + '|','|', charindex('|', @Str + '|') + 1) + 1) -charindex('|', @Str + '|') + 1) + 1) - charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) - 1 ),charindex('|', @Str + '|') + 1) - 1 ),substring(@Str + '|', charindex('|', @Str + '|', substring(@Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1, charindex('|', @Str + '|') + 1) + 1) + 1, charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + charindex('|', @Str + '|', charindex('|', @Str + '|','|', charindex('|', @Str + '|') + 1) + 1) + 1) -charindex('|', @Str + '|') + 1) + 1) + 1) - charindex('|', @Str + '|', charindex('|', @Str + charindex('|', @Str + '|', charindex('|', @Str + '|','|', charindex('|', @Str + '|') + 1) + 1) - 1 ),charindex('|', @Str + '|') + 1) + 1) - 1 ),substring(@Str + '|', charindex('|', @Str + '|', substring(@Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1,charindex('|', @Str + '|') + 1) + 1) + 1) + 1, charindex('|', @Str + '|', charindex('|', @Str + charindex('|', @Str + '|', charindex('|', @Str + '|', '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) -charindex('|', @Str + '|') + 1) + 1) + 1) + 1) - charindex('|', @Str + '|', charindex('|', @Str + charindex('|', @Str + '|', charindex('|', @Str + '|','|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) - 1 ),charindex('|', @Str + '|') + 1) + 1) + 1) - 1 ),substring(@Str + '|', charindex('|', @Str + '|', substring(@Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + charindex('|', @Str + '|', charindex('|', @Str + '|', '|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1,charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1, charindex('|', @Str + '|', charindex('|', @Str + charindex('|', @Str + '|', charindex('|', @Str + '|', '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + charindex('|', @Str + '|', charindex('|', @Str + '|','|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) -charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) - charindex('|', @Str + '|', charindex('|', @Str + charindex('|', @Str + '|', charindex('|', @Str + '|', '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) - 1 ),charindex('|', @Str + '|') + 1) + 1) + 1) + 1) - 1 ),substring(@Str + '|', charindex('|', @Str + '|', substring(@Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + charindex('|', @Str + '|', charindex('|', @Str + '|', '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 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 + '|', charindex('|', @Str + '|', charindex('|', @Str + charindex('|', @Str + '|', charindex('|', @Str + '|','|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 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 + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) - charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) - 1 ),1 ),substring(@Str + '|', charindex('|', @Str + '|', substring(@Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1) + 1,1) + 1, charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + charindex('|', @Str + '|', charindex('|', @Str + '|','|', charindex('|', @Str + '|', charindex('|', @Str + charindex('|', @Str + '|', charindex('|', @Str + '|','|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1) + 1) - 1) + 1) - charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1) - 1 ) 1) - 1 )
declare @str varchar(200)declare @str varchar(200)select @Str = 'Microsoft Corporation|SQL Server|2003|SQL-CLR|2002-select @Str = 'Microsoft Corporation|SQL Server|2003|SQL-CLR|2002-08-20|11:32:00|Document|3.b.3'08-20|11:32:00|Document|3.b.3'SELECTSELECTsubstring(@Str + '|', 0 + 1, substring(@Str + '|', 0 + 1, charindex('|', @Str + '|', 0 + 1) - 0 - 1 ),charindex('|', @Str + '|', 0 + 1) - 0 - 1 ),substring(@Str + '|', charindex('|', @Str + '|') + 1, substring(@Str + '|', charindex('|', @Str + '|') + 1, charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) - charindex('|', @Str + '|') + 1) - charindex('|', @Str + '|') - 1 ),charindex('|', @Str + '|') - 1 ),substring(@Str + '|', charindex('|', @Str + '|', substring(@Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1,charindex('|', @Str + '|') + 1) + 1, charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) -charindex('|', @Str + '|') + 1) + 1) - charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) - 1 ),charindex('|', @Str + '|') + 1) - 1 ),substring(@Str + '|', charindex('|', @Str + '|', substring(@Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1, charindex('|', @Str + '|') + 1) + 1) + 1, charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) -charindex('|', @Str + '|') + 1) + 1) + 1) - charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) - 1 ),charindex('|', @Str + '|') + 1) + 1) - 1 ),substring(@Str + '|', charindex('|', @Str + '|', substring(@Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1,charindex('|', @Str + '|') + 1) + 1) + 1) + 1, charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) -charindex('|', @Str + '|') + 1) + 1) + 1) + 1) - charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) - 1 ),charindex('|', @Str + '|') + 1) + 1) + 1) - 1 ),substring(@Str + '|', charindex('|', @Str + '|', substring(@Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1,charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1, charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) -charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) - charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) - 1 ),charindex('|', @Str + '|') + 1) + 1) + 1) + 1) - 1 ),substring(@Str + '|', charindex('|', @Str + '|', substring(@Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1, charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1, charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1) - charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) + 1) - charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) - 1 ),charindex('|', @Str + '|') + 1) + 1) + 1) + 1) + 1) - 1 ),substring(@Str + '|', charindex('|', @Str + '|', substring(@Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', 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 + '|') + 1) + 1) + 1) + 1) + 1) + 1) + 1, charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', 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 + '|') + 1) + 1) + 1) + 1) + 1) + 1) + 1) - charindex('|', @Str + '|',charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', charindex('|', @Str + '|', 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 + '|') + 1) + 1) + 1) + 1) + 1) + 1) - 1 )
Sql Programming Model Splitting a stringSql Programming Model Splitting a string
Public Shared Sub SplitString()Public Shared Sub SplitString() Dim s As StringDim s As String s = "Microsoft Corporation|SQL s = "Microsoft Corporation|SQL Server|Server|2003|SQL-CLR|2002-08-2003|SQL-CLR|2002-08- 20|11:32:00|20|11:32:00|Document|3.b.3"Document|3.b.3" Dim myArray() As String = Split(s, "|")Dim myArray() As String = Split(s, "|")End SubEnd Sub
The new way…. The new way….
Moving to 64 bitMoving to 64 bit64 bit for Servers and workstations64 bit for Servers and workstations
X64 and IA64 bit supportX64 and IA64 bit support
Enable Yukon and ASP.NETEnable Yukon and ASP.NET
Verifiable managed binaries just run!Verifiable managed binaries just run!
VS: Runs as a 32bit applicationVS: Runs as a 32bit applicationYou can develop, deploy, and debug 32 You can develop, deploy, and debug 32 and 64bit applicationsand 64bit applications
AgendaAgenda
Part I - FundamentalsPart I - FundamentalsDesign Goals Design Goals
ArchitectureArchitecture
CLR ServicesCLR Services
Part II – Visual Studio 2005Part II – Visual Studio 2005Extending the PlatformExtending the Platform
Improving the PlatformImproving the Platform
Innovation in the PlatformInnovation in the Platform
PerformancePerformanceObjectives: make .NET an even greater programming Objectives: make .NET an even greater programming
platformplatformLong-Term: make the performance characteristics of Long-Term: make the performance characteristics of the CLR similar to native codethe CLR similar to native code
Reduce marginal cost of additional managed processesReduce marginal cost of additional managed processes
Reduce startup time and working setReduce startup time and working set
NGenNGenCompiles IL code to native code, saving results to diskCompiles IL code to native code, saving results to disk
Advantages: no need to recompile IL to native code, Advantages: no need to recompile IL to native code, and class layout already set so better startup timeand class layout already set so better startup time
Whidbey: Significant reductions in the amount of Whidbey: Significant reductions in the amount of private, non-shareable working setprivate, non-shareable working set
OS: ‘no-Jit’ plan, all managed code will be NGenedOS: ‘no-Jit’ plan, all managed code will be NGened
Performance everywherePerformance everywhereNew, Performant APIsNew, Performant APIs
APIs for faster resource lookupAPIs for faster resource lookup
Lightweight CodeGen: only generates Lightweight CodeGen: only generates essential code (contrast to Reflect Emit)essential code (contrast to Reflect Emit)
Existing APIs ImprovedExisting APIs Improved
Cross AppDomain RemotingCross AppDomain RemotingBetween 1.1 and 200x faster. Biggest gains for simpler items Between 1.1 and 200x faster. Biggest gains for simpler items (strings, integers, serializable objects)(strings, integers, serializable objects)
Delegate invoke performance has more than Delegate invoke performance has more than doubleddoubled
AppDomain Footprints: significantly reducedAppDomain Footprints: significantly reduced
UTF8Encoding: translation is 2.5x fasterUTF8Encoding: translation is 2.5x faster
TryParseTryParse
RAD DebuggingRAD Debugging
Edit and Continue: Edit Code at runtimeEdit and Continue: Edit Code at runtimeAllowed Edits: ExamplesAllowed Edits: Examples
Add private fields to a classAdd private fields to a class
Add private non-virtual methods to a classAdd private non-virtual methods to a class
Change a function body, even while steppingChange a function body, even while stepping
Disallowed Edits: ExamplesDisallowed Edits: Examples
Removing fields/methodsRemoving fields/methods
Edits to generic classesEdits to generic classes
Serialization will not recognize new fieldsSerialization will not recognize new fields
Display Attributes for a better debugging Display Attributes for a better debugging experienceexperience
CLR SecurityCLR Security
New cryptography supportNew cryptography supportPKI and PKCS7 supportPKI and PKCS7 support
XML encryption supportXML encryption support
Enhanced support for X509 certificatesEnhanced support for X509 certificates
Enhanced Application SecurityEnhanced Application SecurityPermission CalculatorPermission Calculator
Integration with ClickOnceIntegration with ClickOnce
Better SecurityExceptionBetter SecurityException
Debug-In-ZoneDebug-In-Zone
Managed ACL SupportManaged ACL Support
AgendaAgenda
Part I - FundamentalsPart I - FundamentalsDesign Goals Design Goals
ArchitectureArchitecture
CLR ServicesCLR Services
Part II – Visual Studio 2005Part II – Visual Studio 2005Extending the PlatformExtending the Platform
Improving the PlatformImproving the Platform
Innovation in the PlatformInnovation in the Platform
GenericsGenerics
Why generics?Why generics?Compile-time type checkingCompile-time type checking
Performance (no boxing, no downcasts)Performance (no boxing, no downcasts)
Reduced code bloat (typed collections)Reduced code bloat (typed collections)
VB, C#, MC++ produce & consume genericsVB, C#, MC++ produce & consume generics
UseUse generics freely in internal APIsgenerics freely in internal APIs
Consider using generics in public APIsConsider using generics in public APIsGenerics are not yet in CLSGenerics are not yet in CLS
To be CLS compliant, provide a non-generic API To be CLS compliant, provide a non-generic API alternativealternative
Microsoft is actively pursuing standardization of Microsoft is actively pursuing standardization of generics in runtime and languagesgenerics in runtime and languages
Enhancing The Base LibraryOther Generics to look out forEnhancing The Base LibraryOther Generics to look out for
Nullable(Nullable(Of TOf T))Extremely useful for situations where null is Extremely useful for situations where null is a value, such as database valuetypesa value, such as database valuetypes
EventHandlerEventHandler<T><T>Saves on making your own EventHandlersSaves on making your own EventHandlers
Dim intVal as Nullable(Dim intVal as Nullable(Of IntegerOf Integer) = 5) = 5IfIf intVal.HasValue intVal.HasValue ThenThen ‘ checks for a value ‘ checks for a value
delegate voiddelegate void EventHandlerEventHandler<T><T>((ObjectObject sender, sender, TT e) e) wherewhere T : T : EventArgsEventArgs;;
Whidbey Tracing FeaturesWhidbey Tracing FeaturesPluggable FormattersPluggable Formatters
Pre-WhidbeyPre-Whidbey : Formatting of Trace : Formatting of Trace information was predefined, and not information was predefined, and not controllablecontrollable
WhidbeyWhidbey : Predefined formatters : Predefined formatters (delimiter, xml) added, and you can (delimiter, xml) added, and you can make your ownmake your own
MySource;Error;13;Wrong key;;;;;;318361290184;MySource;Error;13;Wrong key;;;;;;318361290184;
Additional ListenersAdditional Listeners
Pre-WhidbeyPre-Whidbey : No Console listener, : No Console listener, ASP had their own tracing mechanismASP had their own tracing mechanism
WhidbeyWhidbey : Added Console listener. : Added Console listener. Integrated ASP tracing into our own, Integrated ASP tracing into our own, and added ETW listenerand added ETW listener
Whidbey Tracing FeaturesWhidbey Tracing FeaturesAuto-generated DataAuto-generated Data
Pre-WhidbeyPre-Whidbey : Standard information such as : Standard information such as timestamp or callstack would have to be timestamp or callstack would have to be explicitly generatedexplicitly generatedWhidbeyWhidbey : An Admin can easily generate this : An Admin can easily generate this data automatically, via config settingsdata automatically, via config settings<<listenerslisteners>>
<<addadd namename="examplelog" ="examplelog" typetype= …= …
Simple Thread IdentificationSimple Thread IdentificationPre-WhidbeyPre-Whidbey : specific threads were difficult : specific threads were difficult to identify, and filter onto identify, and filter onWhidbeyWhidbey : Correlation ID has been added, : Correlation ID has been added, which allows quick and easy identification of which allows quick and easy identification of a thread, and simple subsequent filteringa thread, and simple subsequent filtering
Whidbey Tracing FeaturesWhidbey Tracing Features
Listener FilteringListener FilteringPre-WhidbeyPre-Whidbey : Formatting of Trace : Formatting of Trace information was predefined, and not information was predefined, and not controllablecontrollableWhidbey Whidbey : Assign filtering to : Assign filtering to listeners, so only certain messages listeners, so only certain messages are traced. This allows filtering on are traced. This allows filtering on any property of a message. E.g., ID, any property of a message. E.g., ID, TimeStamp, etc.TimeStamp, etc.
SwitchesSwitchesPre-WhidbeyPre-Whidbey : Couldn’t determine : Couldn’t determine what tracing a component supportedwhat tracing a component supportedWhidbeyWhidbey : Support the ability to : Support the ability to determine what tracing mechanisms determine what tracing mechanisms a component hasa component has
Attend a free chat or web castAttend a free chat or web casthttp://www.microsoft.com/communities/chats/default.mspx http://www.microsoft.com/communities/chats/default.mspx http://www.microsoft.com/usa/webcasts/default.asp http://www.microsoft.com/usa/webcasts/default.asp
List of newsgroupsList of newsgroupshttp://communities2.microsoft.com/http://communities2.microsoft.com/communities/newsgroups/en-us/default.aspxcommunities/newsgroups/en-us/default.aspx
MS Community SitesMS Community Siteshttp://www.microsoft.com/communities/default.mspx http://www.microsoft.com/communities/default.mspx
Local User GroupsLocal User Groupshttp://www.msdnbrasil.com.brhttp://www.msdnbrasil.com.br
Community sitesCommunity siteshttp://www.microsoft.com/communities/related/default.mspxhttp://www.microsoft.com/communities/related/default.mspx
ResourcesResources
BCL BlogBCL Bloghttp://weblogs.asp.net/bclteamhttp://weblogs.asp.net/bclteam
BCL WebsiteBCL Websitehttp://www.gotdotnet.com/team/clr/bcl/default.aspxhttp://www.gotdotnet.com/team/clr/bcl/default.aspx
BCL public mail aliasBCL public mail [email protected]@microsoft.com
ReferenceReference.NET Framework Standard Library Annotated Reference.NET Framework Standard Library Annotated Reference
Applied Microsoft .Net Framework ProgrammingApplied Microsoft .Net Framework Programming
Q & A: Q & A:
SanjheeviRaaman M