2. Table of Contents
1. What is .NET?
ī Microsoft .NET platform architecture
2. What is .NET Framework?
ī .NET Framework Architecture
3. Common Language Runtime (CLR)
4. Managed Code
5. Intermediate Language MSIL
6. Assemblies and Metadata
7. .NET Applications
3. Table of Contents (2)
8. Common Language Infrastructure (CLI) and
integration of different languages
ī Common Language Specification (CLS)
ī CommonType System (CTS)
9. Framework Class Library
10. Integrated Development EnvironmentVisual
Studio
5. What is the .NET Platform?
īŽ The .NET platform
ī Microsoft's platform for software development
ī Unified technology for development of almost
any kind of applications
ī GUI / Web / RIA (rich internet application ) /
mobile / server / cloud / etc.
īŽ .NET platform versions
ī .NET Framework
ī Silverlight / Windows Phone 7
ī .NET Compact Framework
6. What is .NET Framework?
īŽ .NET Framework
ī An environment for developing and executing
.NET applications
ī Unified programming model, set of languages,
class libraries, infrastructure, components and
tools for application development
ī Environment for controlled execution of
managed code
īŽ It is commonly assumed that
ī .NET platform == .NET Framework
7. .NET Framework Components
īŽ Common Language Runtime (CLR)
ī Environment for controlled execution of
programmed code â like a virtual machine
ī Executes .NET applications
īŽ Framework Class Library (FCL)
ī Standard class library for .NET development
ī Delivers basic functionality for developing: XML,
ADO.NET, LINQ, ASP.NET, WPF,WCF,WWF,
Silverlight, Web services, Windows Forms, ...
īŽ SDK, compilers and tools
8. .NET Framework Architecture
ī The OS manages the resources, the
processes and the users of the machine
ī Provides to the applications some
services (threads, I/O, GDI+, DirectX,
COM, COM+, MSMQ, IIS,WMI, âĻ)
ī CLR is a separate process in the OS
Operating System (OS)
9. Operating System (OS)
Common Language Runtime (CLR)
ī CLR manages the execution of
the.NET code
ī Manages the memory,
concurrency, security, ...
.NET Framework Architecture (2)
CLR
10. Operating System (OS)
Common Language Runtime (CLR)
Base Class Library (BCL)
.NET Framework Architecture (3)
ī Rich object-oriented library with
fundamental classes
ī Input-output, collections, text
processing, networking, security,
multi-threading, âĻ
11. Operating System (OS)
Common Language Runtime (CLR)
Base Class Library (BCL)
ADO.NET, LINQ and XML (DataTier)
.NET Framework Architecture (4)
ī Database access
ī ADO.NET, LINQ, LINQ-to-SQL and
Entity Framework
ī Strong XML support
12. Operating System (OS)
Common Language Runtime (CLR)
Base Class Library (BCL)
ADO.NET, LINQ and XML (DataTier)
.NET Framework Architecture (5)
WCF and WWF (Communication and WorkflowTier)
ī Windows Communication
Foundation (WCF) and Windows
Workflow Foundation (WWF) for
the SOA world
13. Operating System (OS)
Common Language Runtime (CLR)
Base Class Library (BCL)
ADO.NET, LINQ and XML (DataTier)
.NET Framework Architecture (6)
WCF and WWF (Communication and WorkflowTier)
ASP.NET
Web Forms, MVC, AJAX
Mobile InternetToolkit
Windows
Forms
WPF Silverlight
ī User interface technologies: Web based,
Windows GUI, WPF, Silverlight, mobile, âĻ
14. Operating System (OS)
Common Language Runtime (CLR)
Base Class Library (BCL)
ADO.NET, LINQ and XML (DataTier)
.NET Framework Architecture (7)
WCF and WWF (Communication and WorkflowTier)
ASP.NET
Web Forms, MVC, AJAX
Mobile InternetToolkit
Windows
Forms
WPF Silverlight
C# C++ VB.NET J# F# JScript Perl Delphi âĻ
ī Programming language on your flavor!
16. Common Language Runtime (CLR)
īŽ Managed execution environment
ī Controls the execution of managed .NET
programming code
īŽ Something like virtual machine
ī Like the JavaVirtual Machine (JVM)
īŽ Not an interpreter
ī Compilation on-demand is used
ī Known as Just InTime (JIT) compilation
īŽ Possible compilation in advance (Ngen)
17. Responsibilities of CLR
īŽ Execution of the IL code and the JIT
compilation
īŽ Managing memory and application resources
īŽ Ensuring type safety
īŽ Interaction with the OS
īŽ Managing security
ī Code access security
ī Role-based security
18. Responsibilities of CLR (2)
īŽ Managing exceptions
īŽ Managing concurrency â controlling the
parallel execution of application threads
īŽ Managing application domains and their
isolation
īŽ Interaction with unmanaged code
īŽ Supporting debug /
profile of .NET code
19. CLR Architecture
Class Loader
IL to Native
JIT Compiler
Code
Manager
Garbage
Collector
Security Engine Debug Engine
Type Checker Exception Manager
Thread Support COM Marshaler
Base Class Library Support
21. Managed Code
īŽ CLR executed code is called managed code
īŽ Represents programming code in the low level
language MSIL (MS Intermediate Language)
īŽ Contains metadata
ī Description of classes, interfaces, properties,
fields, methods, parameters, etc.
īŽ Programs, written in any .NET language are
ī Compiled to managed code (MSIL)
ī Packaged as assemblies (.exe or .dll files)
22. Managed Code (2)
īŽ Object-oriented
īŽ Secure
īŽ Reliable
ī Protected from irregular use of types (type-safe)
īŽ Allows integration between components and
data types of different programming
languages
īŽ Portable between different platforms
ī Windows, Linux, Max OS X, etc.
23. Unmanaged (Win32) Code
īŽ No protection of memory and type-safety
ī Reliability problems
ī Safety problems
īŽ Doesnât contain metadata
ī Needs additional overhead like (e.g. use COM)
īŽ Compiled to machine-dependent code
ī Need of different versions for different
platforms
ī Hard to be ported to other platforms
24. Memory Management
īŽ CLR manages memory automatically
ī Dynamically loaded objects are stored in the
managed heap
ī Unusable objects are automatically cleaned up
by the garbage collector
īŽ Some of the big problems are solved
ī Memory leaks
ī Access to freed or unallocated memory
īŽ Objects are accessed through a reference
26. Intermediate Language
(MSIL, IL, CIL)
īŽ Low level language (machine language) for the
.NET CLR
īŽ Has independent set of CPU instructions
ī Loading and storing data, calling methods
ī Arithmetic and logical operations
ī Exception handling
ī Etc.
īŽ MSIL is converted to instructions for the
current physical CPU by the JIT compiler
27. Sample MSIL Program
.method private hidebysig static void Main() cil managed
{
.entrypoint
// Code size 11 (0xb)
.maxstack 8
ldstr "Hello, world!"
call void
[mscorlib]System.Console::WriteLine(string)
ret
} // end of method HelloWorld::Main
30. .NET Assemblies
īŽ .NET assemblies:
ī Self-containing .NET components
ī Stored in .DLL and .EXE files
ī Contain list of classes, types and resources
ī Smallest deployment unit in CLR
ī Have unique version number
īŽ .NET deployment model
ī No version conflicts (forget the "DLL hell")
ī Supports side-by-side execution of different
versions of the same assembly
31. Metadata in the Assemblies
īŽ Metadata in the .NET assemblies
ī Data about data contained in the assembly
ī Integral part of the assembly
ī Generated by the .NET languages compiler
ī Describes all classes, their class members,
versions, resources, etc.
32. Metadata in Assemblies
Type Description
Assembly Description
Classes, interfaces, inner types, base
classes, implemented interfaces,
member fields, properties, methods,
method parameters, return value,
attributes, etc.
Dependencies on other assemblies
Security permissions
Exported types
[digital
signature]
Name
Version
Localization
33. .NET Applications
īŽ Configurable executable .NET units
īŽ Consist of one or more assemblies
īŽ Installed by "copy / paste"
ī No complex registration of components
īŽ Different applications use different versions of
common assemblies
ī No conflicts due to their "strong name"
īŽ Easy installation, un-installation and update
34. CommonType System (CTS)
īŽ CTS defines the CLR supported types of data
and the operations over them
īŽ Ensures data level compatibility between
different .NET languages
ī E.g. string in C# is the same like String in
VB.NET and in J#
īŽ Value types and reference types
īŽ All types derive from System.Object
36. .NET Languages
īŽ .NET languages by Microsoft
ī C#,VB.NET, Managed C++, J#, F#, JScript
īŽ .NET languages by third parties
ī Object Pascal, Perl, Python, COBOL, Haskell,
Oberon, Scheme, SmalltalkâĻ
īŽ Different languages can be mixed in a single
application
īŽ Cross-language inheritance of types and
exception handling
37. C# Language
īŽ C# is mixture between C++, Java and Delphi
ī Fully object-oriented by design
īŽ Component-oriented programming model
ī Components, properties and events
ī No header files like C/C++
ī Suitable for GUI andWeb applications
ī XML based documentation
īŽ In C# all data types are objects
ī Example: 5.ToString() is a valid call
38. C# Language â Example
īŽ C# is standardized by ISO
īŽ Example of C# program:
using System;
class NumbersFrom1to100
{
static void Main()
{
for (int i=1; i<=100; i++)
{
Console.WriteLine(i);
}
}
}
40. Framework Class Library (FCL)
īŽ Framework Class Library is the standard
.NET Framework library of out-of-the-box
reusable classes and components (APIs)
Base Class Library (BCL)
ADO.NET, LINQ and XML (DataTier)
WCF and WWF (Communication and WorkflowTier)
ASP.NET
Web Forms, MVC, AJAX
Mobile InternetToolkit
Windows
Forms
WPF Silverlight
41. FCL Namespaces
ADO.NET, LINQ and XML (DataTier)
WCF and WWF (Communication and WorkflowTier)
ASP.NET
Web Forms, MVC, AJAX
Mobile InternetToolkit
Windows
Forms
WPF & Silverlight
System.Web
System.Web.Mvc
System.Windows
.Forms
System.Drawing
System.Windows
System.Windows.Media
System.Windows.Markup
System.ServiceModel System.Activities System.Workflow
System.Data System.Linq
System.Data.Linq
System.Xml
System.Xml.Linq System.Data.Entity
43. Visual Studio
īŽ Visual Studio is powerful Integrated
Development Environment (IDE) for .NET
Developers
ī Create, edit, compile and run .NET applications
ī Different languages â C#, C++,VB.NET, J#, âĻ
ī Flexible code editor
ī Powerful debugger
ī Integrated with SQL Server and IIS
ī Strong support of Web services, WCF and WWF
44. Visual Studio (2)
īŽ Visual programming
ī Component-oriented, event based
īŽ Managed and unmanaged code
īŽ Helpful wizards and editors
ī Windows Forms Designer
ī WCF / Silverlight Designer
ī ASP.NET Web Forms Designer
ī ADO.NET / LINQ-to-SQL / XML Data Designer
īŽ Many third party extensions