Professional Documents
Culture Documents
NET
Authentication
Notification
Integrate business
applications and
processes
Back Office
Customer
Service
Sales
Heterogeneous
application and
server
infrastructure
So what is .NET?
.NET is
C#
C++
VB
F#
.NET application
.NET Framework
Class Library (FxCL)
Common Language Runtime (CLR)
Operating System
Hardware
Execution model
The .NET execution model is VM-based
CLR == .NET virtual machine
.EXE
.NET Framework
Class Library (FxCL)
Common Language Runtime (CLR)
VM!
Garbage collection
Language integration
Multiple versioning support (no more DLL hell!)
Integrated security
.NET Framework
Common Language Runtime
.NET Framework
ASP.NET & Windows Forms
ASP .NET
Web Forms Web Services
Mobile Internet Toolkit
Windows
Forms
Operating System
C++
C#
VB.NET
Perl
J#
ASP .NET
Web Forms Web Services
Mobile Internet Toolkit
Windows
Forms
ADO .NET
and XML
Programming
Languages
.NET Framework (Base Class Library)
VB Language
C#Common
Perl Specification
J#
ASP .NET
Web Forms Web Services
Mobile Internet Toolkit
Windows
Forms
C#
VB
Perl
J#
Windows
Forms
ASP .NET
Managed Code
Code that targets the CLR is referred to as
managed code
All managed code has the features of the CLR
Object-oriented
Type-safe
Cross-language integration
Cross language exception handling
Multiple version support
Pointerless environment
Intermediate Language
.NET languages are compiled to an
Intermediate Language (IL)
IL is also known as MSIL or CIL
CLR compiles IL in just-in-time (JIT)
manner each function is compiled just
before execution
The JIT code stays in memory for
subsequent calls
Recompilations of assemblies are also
The GAC
.NET looks in GAC for components of FxCL
Implication?
.NET must be installed for program to run
Presence of GAC ==> .NET is installed
.NET Languages
Languages provided by Microsoft
Third-parties languages
Perl, Python, Pascal, APL, COBOL, Eiffel, Haskell, ML, Oberon, Scheme,
Smalltalk
C# Language
Mixture between C++, Java and Delphi
Component-oriented
C# Language Example
using System;
class HelloWorld
{
public static void main()
{
Console.WriteLine(Hello, world!);
}
}
.Net Assemblies
Implication
.EXE
Source
Code
Language
Compiler
Execution
Native
Code
JIT Compiler
Code
MSIL
Metadata
Also called
Assembly
(.EXE or
.DLL file)
Before installation
or the first time
each method is
called
Assemblies
DLL or EXE file
Smallest deployable unit in the CLR
Have unique version number
No version conflicts (known as DLL hell)
Contains IL code to be executed
Security boundary permissions are granted at the
assembly level
Type boundary all types include the assembly name
they are a part of
Self-describing manifest metadata that describes the
types in the assembly
Metadata in Assembly
Type Descriptions
Classes
Base classes
Implemented interfaces
Data members
Methods
Assembly Description
Name
Version
Culture
Other assemblies
Security Permissions
Exported Types
Write code
Design user interface
Study documentation
Debug
Test
Deploy
UI
HtmlControls
WebControls
Caching
Configuration
Security
SessionState
System.WinForms
Design
System.Drawing
Drawing2D
Printing
Imaging
Text
System.Data
ADO
Design
ComponentModel
System.Xml
SQL
SQLTypes
XSLT
XPath
Serialization
System
Collections
Configuration
Diagnostics
Globalization
IO
Net
Reflection
Resources
Security
ServiceProcess
Text
Threading
Runtime
InteropServices
Remoting
Serialization
System
Collections
Security
Configuration
ServiceProcess
Diagnostics
Text
Globalization
Threading
IO
Runtime
Net
InteropServices
Reflection
Remoting
Resources
Serialization
SQLClient
Common
SQLTypes
System.Xml
XSLT
XPath
Serialization
ASP.NET Namespaces
System.Web
Services
UI
Description
HtmlControls
Discovery
WebControls
Protocols
Caching
Security
Configuration
SessionState
ASP.NET
Platform Neutrality
.NET is a platform neutral technology
.NET is platform-neutral?
.NET applications can be run unchanged on
any platform where .NET is installed
Today this includes:
Windows
Linux and OS X desktop (via Mono)
Linux and OS X browser (via Silverlight / Moonlight )
How?
Like Java, a .NET app == platform-neutral
assembly language
==
.NET application
CIL == Common
Intermediate Language
Assemblies Overview
Assemblies have the following properties:
Assemblies are implemented as .exe or .dll files.
You can share an assembly between applications by placing it in
the Global Assembly Cache.
Assemblies must be strong-named before they can be placed in
the Global Assembly Cache.
Assemblies are only loaded into memory if they are required.
You can use two versions of the same assembly in a single
application.
Private Assemblies
Intended use by single applications. Building modules to group common
functionality.
Location is specified at compile time. Usually in the same folder like the
application's EXE file or in any of the sub folders.
PATH is not checked while looking up files, neither set by Control Panel
'System' configuration nor set in a Console Window.
Identified by name and version if required. But only one version at a time.
Digital signature possible to ensure that it can't be tampered.
Dynamic linking, i.e. loading on demand.
Global Assemblies
Publicly sharing functionality among different application.
Located in Global Assembly Cache (GAC).
Identified by globally unique name and version.
Digital signature to ensure that it can't be tampered.
Get smaller EXE files.
Dynamic linking, i.e. loading on demand.
sn -k "[DriveLetter]:\[DirectoryToPlaceKey]\[KeyName].snk
Change AssemblyInfo.cs file:
*assembly: AssemblyKeyFile(<path to snk>")+
Install in GAC
gacutil -I "[DriveLetter]:\[PathToBinDirectoryInVSProject]\gac.dll
Verify in System Root