.NET Overview.NET Overview
Presented by Presented by Greg SohlGreg Sohl
AgendaAgenda.NET from 20,000 feet.NET from 20,000 feetMajor .NET PiecesMajor .NET PiecesProgramming in .NETProgramming in .NETThe Common Language Runtime (CLR)The Common Language Runtime (CLR)The Framework Class LibraryThe Framework Class LibraryManaged code, Unmanaged code and InteroperabilityManaged code, Unmanaged code and InteroperabilityASP.NETASP.NETToolsToolsSample ApplicationsSample Applications
What to ExpectWhat to Expect
Gain a general understanding of what .NET Gain a general understanding of what .NET is, does and the facilities it provides.is, does and the facilities it provides.
AgendaAgenda.NET from 20,000 feet.NET from 20,000 feetMajor .NET PiecesMajor .NET PiecesProgramming in .NETProgramming in .NETThe Common Language Runtime (CLR)The Common Language Runtime (CLR)The Framework Class LibraryThe Framework Class LibraryManaged code, Unmanaged code and InteroperabilityManaged code, Unmanaged code and InteroperabilityASP.NETASP.NETToolsToolsSample ApplicationsSample Applications
.NET from 20,000 Feet.NET from 20,000 Feet
HistoryHistory Application styles and expectationsApplication styles and expectations API SetsAPI Sets Java / J2EEJava / J2EE
.NET from 20,000 Feet.NET from 20,000 Feet
What it isWhat it is It’s a Software Development SystemIt’s a Software Development System It’s a Runtime SystemIt’s a Runtime System
Addresses Major Software IssuesAddresses Major Software Issues DLL HellDLL Hell Installation ComplexityInstallation Complexity Software Security – Safety of using softwareSoftware Security – Safety of using software
It’s all new, right?It’s all new, right?
AgendaAgenda.NET from 20,000 feet.NET from 20,000 feetMajor .NET PiecesMajor .NET PiecesProgramming in .NETProgramming in .NETThe Common Language Runtime (CLR)The Common Language Runtime (CLR)The Framework Class LibraryThe Framework Class LibraryManaged code, Unmanaged code and InteroperabilityManaged code, Unmanaged code and InteroperabilityASP.NETASP.NETToolsToolsSample ApplicationsSample Applications
Major .NET PiecesMajor .NET Pieces
.NET Framework.NET Framework Common Language RuntimeCommon Language Runtime .NET Framework Class Library.NET Framework Class Library
LanguagesLanguagesHostsHosts.NET Servers.NET ServersTools – Visual Studio.NETTools – Visual Studio.NET
Hosts
Major .NET PiecesMajor .NET Pieces
Common Language Runtime Common Language Runtime
Framework Class LibraryFramework Class Library
VBVB C++C++ C#C#
Visual Visual
Studio.NET
Studio.NET
JScriptJScript ……
.NET Enterprise
.NET Enterprise
ServersServers
IEIE ShellShell IIS / ASP.NETIIS / ASP.NET
AgendaAgenda.NET from 20,000 feet.NET from 20,000 feetMajor .NET PiecesMajor .NET PiecesProgramming in .NETProgramming in .NETThe Common Language Runtime (CLR)The Common Language Runtime (CLR)The Framework Class LibraryThe Framework Class LibraryManaged code, Unmanaged code and InteroperabilityManaged code, Unmanaged code and InteroperabilityASP.NETASP.NETToolsToolsSample ApplicationsSample Applications
Comparing EnvironmentsComparing EnvironmentsThe J2EE/.NET Pet Shop ComparisonThe J2EE/.NET Pet Shop Comparison
AgendaAgenda.NET from 20,000 feet.NET from 20,000 feetMajor .NET PiecesMajor .NET PiecesProgramming in .NETProgramming in .NETThe Common Language Runtime (CLR)The Common Language Runtime (CLR)The Framework Class LibraryThe Framework Class LibraryManaged code, Unmanaged code and InteroperabilityManaged code, Unmanaged code and InteroperabilityASP.NETASP.NETToolsToolsSample ApplicationsSample Applications
Programming in .NETProgramming in .NET
Language neutral designLanguage neutral design
Supported by many languagesSupported by many languages C#, VB.NET, C++C#, VB.NET, C++ JScript.NETJScript.NET Visual J++Visual J++ Delphi (Pascal)Delphi (Pascal) COBOL, Perl, Eiffel, Python, COBOL, Perl, Eiffel, Python,
Smalltalk,Smalltalk,
Programming in .NETProgramming in .NET
Common Type SystemCommon Type System Defines how types are declared, Defines how types are declared,
used, and managed in the runtime used, and managed in the runtime
Defines .NETs OO ModelDefines .NETs OO ModelAll Types inherit from System.ObjectAll Types inherit from System.Object
Provides a common set of Types Provides a common set of Types that “can be” implemented by that “can be” implemented by programming languagesprogramming languages
Programming in .NETProgramming in .NETAnatomy of a type
Type definitions are composed of zero or more member declarations that make the type useful
Fields have storage and hold values of a given type
Methods have signatures and code and represent operations
Constructors are special methods invoked at init-time
Properties and events are hints about method semantics
Nested types provide implementation support for their surrounding type
Access to members can be restricted to intra-type or intraassembly for encapsulation
Programming in .NETProgramming in .NETCommon Type SystemCommon Type System
Programming in .NETProgramming in .NET
The Common Language Specification (CLS) subsets the universally supported types
Programming in .NETProgramming in .NET
Assemblies and the .NET Framework The Common Language Runtime requires all
types to belong to an assembly. Assemblies act as the smallest distribution unit for component code in the .NET Framework.
Programming in .NETProgramming in .NET
Assemblies defined Assemblies are used to package and
distribute executable codeAssemblies are the atom of deployment in the CLRAssemblies are collections of type definitionsType names are scoped by their containing assemblySecurity BoundaryVersion Boundary
Programming in .NETProgramming in .NET
Assemblies and modules An assembly consists of one or more physical files
known as modulesA module is an executable file containing code and metadataEach module may be produced using different programming languagesExactly one module in an assembly contains an assembly manifestCSC.EXE's /t:module and /addmodule switches support module-level compilation/referencesThe assembly linker al.exe can link multiple modules and create the manifest
Programming in .NETProgramming in .NET
Programming in .NETProgramming in .NET
CompilationCompilation Intermediate Language (IL)Intermediate Language (IL) Just-in-Time CompilationJust-in-Time Compilation
Programming in .NETProgramming in .NET
Assembly ContentsAssembly Contents Only the assembly manifest Only the assembly manifest
is required is required
Programming in .NETProgramming in .NET
Language of Choice – C#Language of Choice – C#Recognition of other language useRecognition of other language use JScript.NETJScript.NET VB.NETVB.NET Delphi.NETDelphi.NET Fujitsu COBOL.NETFujitsu COBOL.NET
AgendaAgenda.NET from 20,000 feet.NET from 20,000 feetMajor .NET PiecesMajor .NET PiecesProgramming in .NETProgramming in .NETThe Common Language Runtime (CLR)The Common Language Runtime (CLR)The Framework Class LibraryThe Framework Class LibraryManaged code, Unmanaged code and InteroperabilityManaged code, Unmanaged code and InteroperabilityASP.NETASP.NETToolsToolsSample ApplicationsSample Applications
Common Language RuntimeCommon Language Runtime.NET Components.NET Components
Operating SystemOperating System
Common Language SpecificationCommon Language Specification
Common Language RuntimeCommon Language Runtime
Framework Class Library (BCL)Framework Class Library (BCL)
VBVB C++C++ C#C# Visual Studio.NET
Visual Studio.NET
ASP.NET: Web ServicesASP.NET: Web Servicesand Web Formsand Web Forms
JScriptJScript ……
WindowsWindowsFormsForms
XML, ADO.NET, etc.XML, ADO.NET, etc.
CLR Environment CLR Environment
Common Common LanguageLanguage Runtime Runtime
.NET PE File.NET PE File.NET PE File.NET PE File .NET PE File.NET PE File
PE FilePE File
Native Image SectionNative Image Section.data, .rdata, .rsrc, .text.data, .rdata, .rsrc, .text
CLR DataCLR Data
CLR HeaderCLR Header
MetadataMetadata IL IL
PE/COFF HeadersPE/COFF Headers
MetadataMetadata
Assembly name, version, culture, and Assembly name, version, culture, and public key public key Types that it references Types that it references Types that it exportsTypes that it exportsSecurity requirements for execution Security requirements for execution Descriptions of classes, interfaces, Descriptions of classes, interfaces, methods, properties, fields, events, global methods, properties, fields, events, global methods, etc.. methods, etc..
Intermediate Language (IL)Intermediate Language (IL)
Generated by all .NET compilers Generated by all .NET compilers MSIL Instruction Set Specification MSIL Instruction Set Specification The IL Assembly Language Programmer’s The IL Assembly Language Programmer’s ReferenceReferenceCore of .NET programming Core of .NET programming Fully supports Object Oriented featuresFully supports Object Oriented features Data abstraction, inheritance, polymorphism Data abstraction, inheritance, polymorphism
Also supports exceptions and events Also supports exceptions and events
CLR ExecutablesCLR Executables
Hello World in 2 languagesHello World in 2 languages C#.NETC#.NETusing System;using System;Class MainAppClass MainApp{public static void Main(){public static void Main() { Console.WriteLine(“C# Hello, World!”);} { Console.WriteLine(“C# Hello, World!”);} }} VB.NETVB.NETImports SystemImports SystemPublic Module modmainPublic Module modmain
Sub Main()Sub Main()Console.WriteLine(“VB Hello, World!”)Console.WriteLine(“VB Hello, World!”)
End SubEnd SubEnd ModuleEnd Module
Examining MetadataExamining Metadata
IL disassembler ILDADM.EXEIL disassembler ILDADM.EXE Tree view Tree view Displays the Manifest Displays the Manifest CTL-d to dump to disk CTL-d to dump to disk
Reflection ClassesReflection Classes
System.Reflection namespaceSystem.Reflection namespaceAllows you to examine programmatically Allows you to examine programmatically the manifest of an assemblythe manifest of an assemblyThru Reflection.Emit you can create Thru Reflection.Emit you can create program modules on the flyprogram modules on the fly
CLR ExecutionCLR Execution
Class LoaderClass Loader
.NET PE Files (IL and metadata).NET PE Files (IL and metadata)
JIT Compilers
VerifierVerifier
JITJIT
Execution support and managementExecution support and managementGargage collection, security engine,Gargage collection, security engine,
Code manager, exception manager, threadingCode manager, exception manager, threading
Class LoaderClass LoaderLoads .NET classes into memory and Loads .NET classes into memory and prepares them for execution - searches:prepares them for execution - searches: .config file for the application.config file for the application GAC Global Assembly CacheGAC Global Assembly Cache MetadataMetadataCaches the type information so it doesn’t Caches the type information so it doesn’t have to load the class again have to load the class again Finally - initializes static variables and Finally - initializes static variables and instantiates an object of the loaded classinstantiates an object of the loaded class
JIT CompilerJIT Compiler
Converts IL to managed native codeConverts IL to managed native codeDynamically compile code that is optimized for Dynamically compile code that is optimized for the target machinethe target machineOnly the first time the method is invoked - reads Only the first time the method is invoked - reads the stub the class-loader created to flag a the stub the class-loader created to flag a method for compilation method for compilation Stays in memory until the process shuts downStays in memory until the process shuts downngen.exe – For pre jitting ngen.exe – For pre jitting
Common Language RuntimeCommon Language Runtime
The .NET Show The .NET Show Inside the CLRInside the CLR
CLR – Common Language Runtime CLR – Common Language Runtime Core of the .NET architectureCore of the .NET architectureVirtual Execution Engine manages codeVirtual Execution Engine manages codeLoads modulesLoads modulesVerifies typesVerifies typesJIT compilesJIT compilesGarbage collection, exception handling, Garbage collection, exception handling, security, debugging support, interop security, debugging support, interop
Summary Summary
Let’s Take a Break!Let’s Take a Break!
AgendaAgenda.NET from 20,000 feet.NET from 20,000 feetMajor .NET PiecesMajor .NET PiecesProgramming in .NETProgramming in .NETThe Common Language Runtime (CLR)The Common Language Runtime (CLR)The Framework Class LibraryThe Framework Class LibraryManaged code, Unmanaged code and InteroperabilityManaged code, Unmanaged code and InteroperabilityASP.NETASP.NETToolsToolsSample ApplicationsSample Applications
Framework Class LibraryFramework Class Library
Operating SystemOperating System
Common Language SpecificationCommon Language Specification
Common Language RuntimeCommon Language Runtime
Framework Class Library (BCL)Framework Class Library (BCL)
VBVB C++C++ C#C# Visual Studio.NET
Visual Studio.NET
ASP.NET: Web ServicesASP.NET: Web Servicesand Web Formsand Web Forms
JScriptJScript ……
WindowsWindowsFormsForms
XML, ADO.NET, etc.XML, ADO.NET, etc.
Framework Class LibraryFramework Class Library
The .NET Show The .NET Show Understanding the FrameworkUnderstanding the Framework
Framework Class LibraryFramework Class LibraryADO.NET ArchitectureADO.NET Architecture
DataReaderDataReader
SQL Server and other SQL Server and other OLE DB data storeOLE DB data store
DataSetDataSet
ConnectionConnection
CommandCommand
CommandCommandCommandCommandCommandCommand
ConnectionConnection
Data-Related Components
DataStores
DataAdapter
Managed-Provider Components
Framework Class LibraryFramework Class LibraryADO.NET BenefitsADO.NET Benefits
InteroperabilityInteroperability Don’t need COM on both sides Don’t need COM on both sides Uses XML to transfer data, even through firewallsUses XML to transfer data, even through firewalls ScalabilityScalability Disconnected datasets Disconnected datasets ProductivityProductivity Visual Studio.NET component designer Visual Studio.NET component designer Type safetyType safety PerformancePerformance Disconnected datasets Disconnected datasets No need for type conversionsNo need for type conversions
Framework Class LibraryFramework Class Library Important ADO.NET Data ObjectsImportant ADO.NET Data Objects
DataSetDataSetDataTableCollectionDataTableCollection
DataTableDataTable DataRowCollection DataRowCollection
DataRowDataRow DataColumnCollectionDataColumnCollection
DataColumnDataColumn DataViewDataView
DataRelationCollectionDataRelationCollectionDataRelation DataRelation
Framework Class LibraryFramework Class LibraryADO.NETADO.NET
XML Classes make the dataset extremely XML Classes make the dataset extremely portable portable ReadXml ReadXml WriteXmlWriteXml WriteXmlSchemaWriteXmlSchema
Framework Class LibraryFramework Class LibraryADO.NET Managed ProvidersADO.NET Managed Providers
Common Interface for accessing data Common Interface for accessing data Implementation of Implementation of
System.Data.Common.DbDataAdapter System.Data.Common.DbDataAdapter objectsobjects
SQL Server, OLE DB ship with .NETSQL Server, OLE DB ship with .NETOracle & ODBC are now availableOracle & ODBC are now availableOther vendors are building providers for Other vendors are building providers for other databasesother databases
IdbCommandIdbCommand
IdbCommandIdbCommandOleDbCommandOleDbCommand SqlCommandSqlCommand
IDbConnectionIDbConnection
OleDbConnectionOleDbConnection SqlConnectionSqlConnection
IDataParameterCollectionIDataParameterCollection
OleDbParameterCollectionOleDbParameterCollection SQLParameterCollectionSQLParameterCollection
Framework Class LibraryFramework Class LibraryADO.NET Reader ObjectADO.NET Reader Object
New in ADO.NET New in ADO.NET Data Reader similar to a stream object Data Reader similar to a stream object Very efficient Very efficient Forward onlyForward only Sequential OrderSequential Order
Recommended method of populating the Recommended method of populating the datasetdataset
Framework Class LibraryFramework Class Library
Bertrans Meyer’s .NET Training CourseBertrans Meyer’s .NET Training Course A Survey of the LibrariesA Survey of the Libraries
Framework Class LibraryFramework Class Library
Distributed Application SupportDistributed Application Support .NET Remote Invocation Services.NET Remote Invocation Services
Web ServicesWeb Services System. Web.Services.WebServiceSystem. Web.Services.WebService
Remoting ServicesRemoting Services System.RemotingSystem.Remoting
Message QueuesMessage Queues ASP.NET as an Application ServerASP.NET as an Application Server
ASP.NETASP.NET
New Web Programming ModelNew Web Programming Model Totally .NET – Do web programming in Totally .NET – Do web programming in
any .NET language.any .NET language.
Plug-in to IISPlug-in to IISCompiled ExecutionCompiled ExecutionTool SupportTool SupportClass & Control LibraryClass & Control LibraryHost for Remoting & Web ServicesHost for Remoting & Web Services
AgendaAgenda.NET from 20,000 feet.NET from 20,000 feetMajor .NET PiecesMajor .NET PiecesProgramming in .NETProgramming in .NETThe Common Language Runtime (CLR)The Common Language Runtime (CLR)The Framework Class LibraryThe Framework Class LibraryManaged code, Unmanaged code and InteroperabilityManaged code, Unmanaged code and InteroperabilityASP.NETASP.NETToolsToolsSample ApplicationsSample Applications
Managed, Unmanaged and Managed, Unmanaged and InteroperabilityInteroperability
Managed Code = IL code run by the CLR Managed Code = IL code run by the CLR Unmanaged Code = COM Objects, Win32 Unmanaged Code = COM Objects, Win32 applications, Active-X Controls, i.e. applications, Active-X Controls, i.e. anything else under Windows anything else under Windows Interop – the ability to run managed code Interop – the ability to run managed code from unmanaged code or run unmanaged from unmanaged code or run unmanaged code from managed code code from managed code
Interop – Calling unmanaged DLL Interop – Calling unmanaged DLL from .NETfrom .NET
Calling Unmanaged MessageBoxCalling Unmanaged MessageBox
using System.Runtime.InteropServices; using System.Runtime.InteropServices; public class Win32 {public class Win32 { [DllImport("user32.dll", CharSet=CharSet.Auto)][DllImport("user32.dll", CharSet=CharSet.Auto)] public static extern int MessageBox(int hWnd, String text, public static extern int MessageBox(int hWnd, String text, String caption, uint type); String caption, uint type); } } public class HelloWorld { public static void Main() public class HelloWorld { public static void Main()
{ Win32.MessageBox(0, "Hello World", "Platform Invoke { Win32.MessageBox(0, "Hello World", "Platform Invoke Sample", 0); } Sample", 0); }
} }
Using a COM WrapperUsing a COM Wrapper
AgendaAgenda.NET from 20,000 feet.NET from 20,000 feetMajor .NET PiecesMajor .NET PiecesProgramming in .NETProgramming in .NETThe Common Language Runtime (CLR)The Common Language Runtime (CLR)The Framework Class LibraryThe Framework Class LibraryManaged code, Unmanaged code and InteroperabilityManaged code, Unmanaged code and InteroperabilityASP.NETASP.NETToolsToolsSample ApplicationsSample Applications
.NET Tools.NET Tools
Visual Studio .NETVisual Studio .NETILDASMILDASM.NET Framework Configuration.NET Framework ConfigurationSQL ServerSQL Server
AgendaAgenda.NET from 20,000 feet.NET from 20,000 feetMajor .NET PiecesMajor .NET PiecesProgramming in .NETProgramming in .NETThe Common Language Runtime (CLR)The Common Language Runtime (CLR)The Framework Class LibraryThe Framework Class LibraryManaged code, Unmanaged code and InteroperabilityManaged code, Unmanaged code and InteroperabilityASP.NETASP.NETToolsToolsSample ApplicationsSample Applications
Sample ApplicationsSample Applications
Duwamish 7 BookstoreDuwamish 7 BookstoreFitch & Mather Online BrokerageFitch & Mather Online BrokerageDiggerDigger
ResourcesResourcesMSDN (msdn.microsoft.com/net)MSDN (msdn.microsoft.com/net)ASP.Net (ASP.Net (www.asp.net))www.gotdotnet.comwww.gotdotnet.comwww.sellsbrothers.comwww.windowsforms.netwww.c-sharpcorner.com.NET Patterns and Practices.NET Patterns and Practices
msdn.microsoft.com/practices/msdn.microsoft.com/practices/
.NET Six-Week Series .NET Six-Week Series msdn.microsoft.com/net/guide/msdn.microsoft.com/net/guide/
Books! We have a number of books in house.Books! We have a number of books in house.
Questions?Questions?