Introduction to.NET Technology Overview Sean Puffett Developer & Platform Group Microsoft Ltd

Embed Size (px)

DESCRIPTION

MSDN Connection Get personalised info and a customised RSS feed The programming language(s) you’re interested in The technology area(s) you’re interested in The information you want View news, technical resources, events, webcasts and community information Sign up for MSDN Connection at:

Citation preview

Introduction to.NET Technology Overview Sean Puffett Developer & Platform Group Microsoft Ltd The slides for this event will be posted at: MSDN Connection Get personalised info and a customised RSS feed The programming language(s) youre interested in The technology area(s) youre interested in The information you want View news, technical resources, events, webcasts and community information Sign up for MSDN Connection at: Agenda The evolution of.NET The Common Language Infrastructure.NET Programming Languages Building Types for.NET Common Language Runtime Services The.NET Framework How to get.NET Where did.NET come from? Platform wants to raise abstraction level by offering more services to code Serialization? Memory? Type-Safety? etc. Problems? Todays compiler eats the programmers intent Leaves the platform guessing as to how to help pushebp ldeax, 0x popebp Class Customer { public: void Process() } Compile & Link Where did.NET come from? Existing component technology (COM) has some issues COM client and COM server are very tightly coupled together COM model only goes so far. Lacks; A common type system across language VB uses SAFEARRAY, C++ does not A common description mechanism for components Type libraries are optional and incomplete at best A mechanism for versioning, deployment, registration A mechanism for knowing whether to trust code Do we download an ActiveX control or not? The.NET Evolution Part 1 Before COM, applications were completely separate entities with little or no integration Applicatio n Code and data structures The.NET Evolution Part 2 COM provides a way for components to integrate; However, each component must provide the plumbing and objects cannot directly interact The.NET Evolution Part 3 With the.NET Framework common language runtime, components are built on a common substrate; No plumbing is needed and objects can directly interact Agenda The evolution of.NET The Common Language Infrastructure.NET Programming Languages Building Types for.NET Common Language Runtime Services The.NET Framework How to get.NET Common Language Specification Common Language Infrastructure ECMA Standard 335 Common Type System (CTS) Int16 Int32 float double string object Executable File Format Metadata Code (CIL) Common Language Runtime (CLR) Common Intermediate Language (CIL).ldstr Hello World Base Class Library Agenda The evolution of.NET The Common Language Infrastructure.NET Programming Languages Building Types for.NET Common Language Runtime Services The.NET Framework How to get.NET string s = "authors"; SqlCommand cmd = new SqlCommand("select * from "+s, sqlconn); cmd.ExecuteReader(); C# Dim s as String s = "authors" Dim cmd As New SqlCommand("select * from " & s, sqlconn) cmd.ExecuteReader() Visual Basic Programming Languages C++ String *s = S"authors"; SqlCommand cmd = new SqlCommand(String::Concat(S"select * from ", s), sqlconn); cmd.ExecuteReader(); Compiling for the CLR? Visual Basic C#C++ jscript.net Compiler.NET Assembly Metadata Code (CIL) Hello World CIL, Assemblies & Metadata Execution on the CLR Common Language Runtime (CLR) Class Loader IL to Native Compilers Code Manager Garbage Collector Security EngineDebug Engine Type CheckerException Manager Thread SupportCOM Marshaler Base Class Library Support.NET Assembly Metadata Code (CIL) Just In Time Native Code Verified?Permitted? Agenda The evolution of.NET The Common Language Infrastructure.NET Programming Languages Building Types for.NET Common Language Runtime Services The.NET Framework How to get.NET Building Types for.NET.NET type system is partitioned into Value Types & Reference Types All types share a common base type System.Object New types are constructed out of; Methods Properties & Fields Events & Delegates Interfaces The building blocks of.NET types Agenda The evolution of.NET The Common Language Infrastructure.NET Programming Languages Building Types for.NET Common Language Runtime Services The.NET Framework How to get.NET Naming.NET Assemblies.NET Assemblies have names comprising; Simple name (always present) Culture Version Public key token An assembly with all 4 parts is a strongly named assembly Cryptographic checks can prove assembly is unaltered since the point of production Deploying.NET Assemblies Two deployment models for.NET assemblies Private Default model All code lives in the applications folder Install involves copying files, uninstall deleting files Versioning is under the control of the developer Shared Single installation folder named the Global Assembly Cache (GAC) Stores multiple versions & cultures of same assembly Install involves additional registration steps Assembly must be strongly named Resolving.NET Assemblies Assembly manifest records details of all referenced types external to the assembly At run time, on demand, CLR loads referenced assemblies and types CLR has rules for assembly resolution Works out the right version (config + policy) Checks the Global Assembly Cache (GAC) Probes for the assembly in the current folder hierarchy Note: Only strongly-named assemblies get version checking and GAC checking Assembly loading & versioning with the CLR Memory Management CLR provides automatic memory features Automatically determines class layout at runtime Automatically manages object lifetimes Automatically reclaims/reuses memory from dead objects through garbage collection Logically the CLR; Periodically halts program execution Examines all allocated objects and determines which are still reachable by variables All space used by unreachable objects is claimed for re-use Object references may be altered by this process Automatic Memory Management Applying Security Policy CLR has a new, innovative security model Code Access Security Assembly forms the security boundary All code executing in one assembly has the same permissions Assembly Metadata Code (CIL) Evidence Folder? Publisher? Web Site URL? Web Site Zone Hash? Strong Name? Policy User Machine Enterprise Permissions Code Access Security Working with Existing Code Mainstream.NET programming provides 2 ways to reach existing code Platform Invoke (P/Invoke) Allows.NET code to call out to functions exported from DLLs Allowing for call backs into.NET code COM Interop Exposes COM objects as.NET objects Exposes.NET objects as COM objects Working with existing code Agenda The evolution of.NET The Common Language Infrastructure.NET Programming Languages Building Types for.NET Common Language Runtime Services The.NET Framework How to get.NET Unifying Programming Models Consistent API availability regardless of language and programming model Stateless, Code embedded in HTML pages Sub-classing,Power,Expressiveness RAD,Composition,Delegation VB Forms Windows API MFC & ATLASP.NET Framework System System.DataSystem.Xml System.Web Globalization Diagnostics Configuration Collections Resources Reflection Net IO Threading Text ServiceProcess Security Design OleDb SqlTypes SqlClient XPath XSLT Runtime InteropServices Remoting Serialization ConfigurationSessionState CachingSecurity Services Description Discovery Protocols UI HtmlControls WebControls System.Drawing Imaging Drawing2D Text Printing System.Windows.Forms DesignComponentModel.NET Framework Sketch CLR, Framework & Tools Operating System Common Language Runtime Base Class Library ADO.NET and XML ASP.NETWindowsForms Common Language Specification VBC++C#JScriptJ# Visual Studio.NET Web Services Web Forms Agenda The evolution of.NET The Common Language Infrastructure.NET Programming Languages Building Types for.NET Common Language Runtime Services The.NET Framework How to get.NET Get.NET.NET Framework V1.1 Server 2003, XP, 2000, NT, ME, 98 Pre-installed on Server 2003 Software Development Kit RedistributableRedistributable (23MB) Service Pack 1 Visual Studio.NET 2003 On MSDN Other Resources Get more information on the.NET Framework Try Visual StudioTake a look at the Express productsGotDotNet and ASP.NET The UK MSDN Site & Flash local news, events, webcasts 2004 Microsoft Limited. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.