Architecture .NET FrameWork

Download Report

Transcript Architecture .NET FrameWork

Introduction au .NET FrameWork
Stéphane RZETELNY - Ingénieur 2000 - Informatique Réseaux
Octobre 2002
PLAN
•
•
•
•
•
•
•
Qu’est-ce que le .NET FrameWork ?
Les objectifs du .Net FrameWork
Notion d’assemblée
Comment ça fonctionne
Interopérabilité
Standardisation du .Net FrameWork
.Net FrameWork et Linux
Qu’est-ce que le .NET FrameWork ?
• Un nouvel environnement de
développement et d’exécution
• L’introduction d’un nouveau langage : C#
• Une bibliothèque de classes extensibles,
regroupées par namespace en C#
Objectifs du .NET Framework
Environnement d’exécution robuste et sécurisé
•Common Language Runtime (CLR)
•Code managé : Garbage Collector, Type Safe..
•Runtime Security
Déploiement et administration simplifiés
•Xcopy, Versioning
Intégration de l’existant
•Multiples langages de programmation
•Interopérabilité COM et Win32
•Compatibilité « side by side »
Développement d’applications simplifié
•Modèle de programmation unifié
•Elever le niveau d’abstraction
• classe, interface, héritage, propriété, constructor, exception…
• Elimination complète de la plomberie COM
•Bibliothèque de classe riche et extensible
•Intégration native des standards Web (HTTP,XML, SOAP, ...)
CLR : Vue d’ensemble
Base Class Library Support
Thread Support
COM Marshaler
Type Checker
Exception Manager
Security Engine
Debug Engine
IL to Native
Compilers
Code
Manager
Class Loader
Garbage
Collector
Assembly : Définition
•
•
•
•
•
•
•
Unité de déploiement
Point d’entrée d’exécution
Unité de contrôle de sécurité
Unité de contrôle de version
Unité de réutilisation
Unité de visibilité des types
Unité d’exécution « cote à cote »
Assembly : 2 formes d’utilisation
• On considère 2 types d’assembly :
– Privée : Dédiée à l’utilisation d’un programme
particulier. Se situe généralement dans
l’arborescence du programme qui l’utilise.
– Partagée : Utilisée par un ensemble de
programme différents. Se situe généralement
dans le GAC (Global Assemblies Cache)
Assembly : contenu
•
•
•
•
•
Un manifest : metadonnées de l’assembly
Les métadonnées décrivant les types utilisés
Le code IL
Les ressources utilisées (images,…)
La liste des fichiers qui la compose
Global Assemblies Cache (GAC)
• Un cache accueillant les assemblées partagées
par plusieurs applications
• Doivent être définies avec des « noms forts »
– Grâce au mécanisme de clé privée, clé publique
– Pour garantir l’unicité d’une version d’une assemblée
– Pour garantir l’intégrité de l’assemblée
• Doivent faire référence à des assemblées
fortement nommées !
Comment ça marche : 1. Le Développement
DEVELOPMENT
public static void Main(String[] args )
{ String usr; FileStream f; StreamWriter w;
try {
usr=Environment.GetEnvironmentVariable("USERNAME");
f=new FileStream(“C:\\test.txt",FileMode.Create);
w=new StreamWriter(f);
public static void Main(String[] args )
w.WriteLine(usr);
{ String usr; FileStream f; StreamWriter w;
w.Close();
try {
} catch (Exceptionusr=Environment.GetEnvironmentVariable("USERNAME");
e){
Console.WriteLine("Exception:"+e.ToString());
f=new FileStream(“C:\\test.txt",FileMode.Create);
}
w=new StreamWriter(f);
}
w.WriteLine(usr);
w.Close();
} catch (Exception e){
Console.WriteLine("Exception:"+e.ToString());
}
}
Source code
Compiler
Assembly
C#
J#
VB
Cobol
…
MSIL
Metadata
Resources
Comment ça marche : 2.Le Déploiement
DEVELOPMENT
public static void Main(String[] args )
{ String usr; FileStream f; StreamWriter w;
try {
usr=Environment.GetEnvironmentVariable("USERNAME");
f=new FileStream(“C:\\test.txt",FileMode.Create);
w=new StreamWriter(f);
public static void Main(String[] args )
w.WriteLine(usr);
{ String usr; FileStream f; StreamWriter w;
w.Close();
try {
} catch (Exceptionusr=Environment.GetEnvironmentVariable("USERNAME");
e){
Console.WriteLine("Exception:"+e.ToString());
f=new FileStream(“C:\\test.txt",FileMode.Create);
}
w=new StreamWriter(f);
}
w.WriteLine(usr);
w.Close();
} catch (Exception e){
Console.WriteLine("Exception:"+e.ToString());
}
}
Assembly Compiler
Source code
C#
J#
VB
Cobol
…
DEPLOYMENT
Install Assembly
MSIL
Setup
Copy Metadata
BrowserResources
Global
Assembly
Cache (GAC)
Application
Directory
Download
Cache
Comment ça marche : 3. L’exécution
DEPLOYMENT
DEVELOPMENT
Install
Assembly
Setup
Copy
Browser
EXECUTION
IL to Native
Compiler
Native .exe
+ GC table
Class
Loader
Code
Manager
Security
Assembly
Global
on Target Policy
Assembly
Machine
Cache
(GAC)
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<mscorlib>
<security>
<policy>
<PolicyLevel version="1">
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="Nothing"
Name="All_Code"
Description="Code group
grants no permissio
ns and forms the root of the code group tree.">
<IMembershipCondition clas
s="AllMembershipCondition"
version="1"/>
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Application
Directory
Assembly
Loader
Download
Cache
Garbage Collection
Exception Manager
Thread Support
Debug Engine
COM Interop
Interopérabilité
• Interopérabilité des langages, grâce au
langage intermédiaire (IL)
• Interopérabilité avec COM
• Interopérabilité avec Win32
Standardisation
• C# et CLI qui sont déposés à l'ECMA
CLI (Common Language Infrastructure) est très précis quand a
ce que l'on doit trouver dans le "framework " et le "runtime " et
laisse champ libre sur la manière de l'implémenter
– ECMA-334, C# (C sharp) Language Specification.
– ECMA-335, Common Language Infrastructure, approved by the
ECMA General Assembly of 13th December 2001.
– ECMA TR/84, related to Standard ECMA-335
.Net FrameWork et Linux !
• Début du « portage » du framework .Net
• Différents projets :
– Mono par le créateur de gnome
– GNU Portable DotNet
– Rotor (FreeBSD)
Sites Internet
•
•
•
•
http://www.gotdotnet.com
http://www.dotnetguru.org
http://www.dotnet-fr.org/
http://msdn.microsoft.com/netframework/
• http://www.go-mono.com/
• http://www.southern-storm.com.au/