Title: Introduksjon til .NET
1XXXXXXXXXXXXXXXXXXX
- Introduksjon til .NET
- Jonas Follesø, Abeo AS
- http//jonas.follesoe.no
- jonas_at_follesoe.no
2Agenda
- Hva er .NET Framework
- The Common Language Runtime
- The Framework Class Libraries
- Støtte for flere progammeringsspråk
- Støtte for flere platformer
- Gode utviklingsverktøy
- Hvordan komme i gang?
- Demoer ?
3Hva er .NET?
- En utviklingsplattform grensesnitt, komponenter
og verktøy for å utvikle programvare. - Den største endringen i Microsofts
utviklingsplattform siden Windows NT erstattet
DOS - Hva er nytt?
- Programmerings språk, kompilatorer
- Måten kode er lastet og eksekvert
- Sikkerhetsmodell
- Objektmodell, metadata, distribuerte systemer
- Klassebiblioteker
-
4.NET - Microsofts visjon for programvare
- Gjøre distribuerte systemer tilgjeng via
Internett - Sømløs integrasjon mellom flere applikasjoner og
enheter - Levere programvare som en tjeneste
- Neste generasjon brukeropplevelser
- .NET Framework er programmeringsmodellen som skal
lansere .NET visjonen.
5.NET Framework
- Common Language Runtime (CLR)
- Multi-language support
- Common type system
- Simplified deployment
- Code Access Security
- Rich Class libraries
- Powerful, Consistent Programming Model
- Focus on code, not plumbing
- Built for Tools
- Support for design-time functionality
- Debugging, profiling, instrumentation support
C
VB.NET
C
J
Others
Web Forms
Web Services
Win Forms
ADO.NET and XML
Base Class Libraries
Common Language Runtime
6Common Language Runtime
DEVELOPMENT
public static void Main(String args ) String
usr FileStream f StreamWriter w try
usrEnvironment.GetEnvironmentVariable("USERNAME")
fnew FileStream(C\\test.txt",FileMode.Cre
ate) wnew StreamWriter(f)
w.WriteLine(usr) w.Close() catch
(Exception e) Console.WriteLine("Exception"
e.ToString())
public static void Main(String args ) String
usr FileStream f StreamWriter w try
usrEnvironment.GetEnvironmentVariable("USERNAME")
fnew FileStream(C\\test.txt",FileMode.Cre
ate) wnew StreamWriter(f)
w.WriteLine(usr) w.Close() catch
(Exception e) Console.WriteLine("Exception"
e.ToString())
C J VB Cobol
Source code
MSIL Metadata Resources
7Common Language Runtime
DEPLOYMENT
Setup Copy Browser Click Once
8Common Language Runtime
DEPLOYMENT
Policy lt?xml version"1.0" encoding"utf-8"
?gt ltconfigurationgt ltmscorlibgt
ltsecuritygt ltpolicygt
ltPolicyLevel version"1"gt
ltCodeGroup class"UnionCodeGroup"
version"1"
PermissionSetName"Nothing"
Name"All_Code"
Description"Code group grants no permissions
and forms the root of the code group tree."gt
ltIMembershipCondition
class"AllMembershipCondition"
version"1"/gt
ltCodeGroup class"UnionCodeGroup"
version"1"
PermissionSetName"FullTrust"
EXECUTION
9.NET Namespace
System.Web
System.WinForms
Services
UI
Design
ComponentModel
Description
HtmlControls
Discovery
WebControls
Protocols
System.Drawing
Caching
Security
Drawing2D
Printing
Text
Configuration
SessionState
Imaging
System.Data
System.Xml
ADO
SQL
XSLT
Serialization
Design
SQLTypes
XPath
System
Collections
IO
Security
Runtime
InteropServices
Configuration
Net
ServiceProcess
Remoting
Diagnostics
Reflection
Text
Serialization
Globalization
Resources
Threading
10CLR Design Goals
- Forenklet applikasjonsutvikling
- Robust og sikkert kjøremiljø for kode
- Støtte for flere programmeringsspråk
- Enklere utrulling og vedlikehold
11Enklere utvikling
Windows API
HWND hwndMain CreateWindowEx( 0,
"MainWinClass", "Main Window",
WS_OVERLAPPEDWINDOW WS_HSCROLL WS_VSCROLL,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, (HWND)NULL, (HMENU)NULL,
hInstance, NULL) ShowWindow(hwndMain,
SW_SHOWDEFAULT) UpdateWindow(hwndMain)
.NET Framework
Form form new Form() form.Text "Main
Window" form.Show()
12Enklere utvikling
- Organization
- Code organized in hierarchical namespaces and
classes - Unified type system
- Everything is an object, no variants, one string
type, all character data is Unicode - Component Oriented
- Properties, methods, events, and attributes are
first class constructs - Design-time functionality
13Robust og sikkert
- Automatic lifetime management
- All .NET objects are garbage collected
- No stray pointers, no circular references
- Code correctness and type-safety
- IL can be verified to guarantee type-safety
- No unsafe casts, no uninitialized variables,
no out-of-bounds array indexing - Evidence-based security
- Based on origin of code as well as user
- Extensible permissions
14Støtte for flere språk
- Velg språk som passer deg
- All .NET funksjonalitet er tilgjennlig i alle
programmeringsspråk - En applikasjon kan skrives i flere språk
- Debuggere, kodeanalyse, profilering osv fungerer
for alle språk. - Tilgjenglie kompilatorer
- Fra Microsoft VB, C, C, JScript, Java
- Fra andre APL, COBOL, Eiffel, Fortran, Haskell,
ML, Perl, Python, RPG, Scheme, Smalltalk,
15Uniform programmeringsmodell
16Bred støtte for flere språk
Dim s as String s "authors" Dim cmd As New
SqlCommand("select from " s,
sqlconn) cmd.ExecuteReader()
VB.NET
string s "authors" SqlCommand cmd new
SqlCommand("select from "s, sqlconn) cmd.Execu
teReader()
C
C
String s S"authors" SqlCommand cmd new
SqlCommand(StringConcat(S"select from ", s),
sqlconn) cmd.ExecuteReader()
17Bred støtte for flere språk
String s S"authors" SqlCommand cmd new
SqlCommand(StringConcat(S"select from ", s),
sqlconn) cmd.ExecuteReader()
Perl
s "authors" cmd SqlCommand("select from "
s, sqlconn) cmd.ExecuteReader()
Python
assembly_external(name"System.Data.SqlClient.SqlC
ommand") sqlcmdcharacter10 xsqlcmd Cmd
x'authors' cmd sqlcmd("select from "//x,
sqlconn) call cmd.ExecuteReader() end
Fortran
18Bred støtte for flere språk
(let ( (s "authors") (cmd (new-SqlCommand
(string-append "select from " s)
sqlconn))) (execute-command cmd))
Scheme
local s STRING cmd SQLCOMMAND do
s "authors" create cmd("select
from " s, sqlconn) cmd.ExecuteReader() end
Eiffel
ExecuteReader invoke System.Data.SqlClient.Execu
teReader() SqlCommand create
System.Data.SqlClient.SqlCommand(String,\
System.Data.SqlClient.SqlConnection) qu
ery sqlconn -gt let s "authors" in
cmd lt- SqlCommand ("select from "s, sqlconn)
cmd ExecuteReader()
Mondrian
19Enklere utrulling og administrasjon
- Assemblies
- The unit of deployment, versioning, and security
- Like DLLs, but self-describing through manifest
- Zero-impact install
- Applications and components can be shared or
private - Side-by-side execution
- Multiple versions of the same component can
co-exist, even in the same process
20Web Services
- Expose APIs across the Internet
- HTML human -- machine
- XML/SOAP machine -- machine
- Leverage the Web
- The same infrastructure
- Interoperability
- Distributed scalable applications
- Stateless
- Internet and Intranet
21Web Services
Application Concepts
Data
Schema
Services
Invocation
22- Web Service demo, klient og deployment
23.NET Compact Framework
- .NET rammeverket på mobile enheter
- Subset av .NET Framework
- Samme utviklingsverktøy,programmeringsspråkog
rammeverk
24(No Transcript)
25.NET oppsummering
- Microsoft satser tungt på .NET
- Visual Studio 2005 7.5 million lines
- SQL Server 2005 3 million lines
- BizTalk Server 2 million lines
- Visual Studio Team System 1.7 million lines
- Windows Presentation Foundation 900K lines
- Windows Sharepoint Services 750K lines
- Expression Interactive Designer 250K lines
- Sharepoint Portal Server 200K lines
- Content Management Server 100K lines
- Kan du .NET kan du enkelt programmere mot alle
nye Microsoft produkter - WinFX kommer, bygd på toppen av. NET
26Hvordan komme i gang?
- Last ned Visual Studio Express Editions
- http//msdn.microsoft.com/express
- For mer informasjon om .NET
- http//msdn.microsoft.com/netframework
- To gode boktips
- Microsoft Visual C 2005 Express Edition Build
a Program Now! - Microsoft Visual Web Developer 2005 Express
Edition Build a Web Site Now!
27Materiell
- I posen har du informasjon/tilbud fra Microsoft
og partnere, godis og skrivesaker - Bakerst i rommet finner du materiell tilpasset
denne sesjonen. Forsyn deg! - Vi setter pris på tilbakemeldinger på materiellet
dere får utdelt.
28Til slutt.
- Hjelp oss å bli bedre
- Fyll ut evalueringen som kommer på e-post
- Gi direkte råd til Microsoft-representanter
- Hold deg oppdatert
- www.microsoft.no/informasjon eller fyll ut et
Hold deg oppdatert kort - Besøk oss på www.microsoft.no