Title: Introduction to'NET
1 Think Smart
2.Net Framework
Rai Yawar Ijaz Microsoft Most Valuable
Professional Chair, INETA Islamabad
Region VP,Innoventors Project Manager,
Quntech Bioinformatics Research
3Agenda
- What is .Net Framework
- Common Language Runtime
- Assemblies(Modules,CTS/CLS)
- Memory management in .Net
- Execution Model
- .Net security Model
- ASP.NET
- ADO.NET
4(No Transcript)
5Development Challenges
- Software Integration
- Language silo problem
- Development and deployment complexity
- Multiple programming models
- Security not inherent
6The .NET FrameworkWhat Is the .NET Framework?
- A set of technologies that
- unite todays isolated Web applications
- make information available anytime, anywhere
- simplify development and deployment
- How does .NET achieve the above?
- Web services
- ADO.NET DataSets and XML support throughout the
platform - rich tools, runtime services, and XCOPY deployment
7.Net Framework
- Common Language Runtime (CLR)
8Common Language RuntimeExecution Model
Source code
Visual Basic
C
C
Unmanaged component
Compiler
Compiler
Compiler
Managed code
Assembly IL code
Assembly IL code
Assembly IL code
Common language runtime
JIT compiler
Native code
Operating system services
9The CLR
Base Class Library Support
Thread Support
COM Marshaler
Class Loader
10.Net Framework Classes
System.Web (ASP .NET)
System.WinForms
Services
UI
Design
ComponentModel
Description
HTMLControls
Discovery
WebControls
Protocols
System.Drawing
Caching
Security
Drawing2D
Printing
Configuration
SessionState
Imaging
Text
System.Data (ADO .NET)
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
11Common Language Runtime
- Execution engine for .NET framework applications.
- Services provided.
- Code management (loading and execution).
- Application memory isolation.
- Verification of type safety.
- Conversion of IL to native code.
- Enforcement of code access security
- Exception handling, including cross-language
exceptions - Interoperation between managed code, COM objects,
and pre-existing DLLs (unmanaged code and data) - .
12Common Language RuntimeGoals
- Development
- standard class framework
- automatic memory management
- consistent error handling
- mixed-language applications
- multiple platforms
- safer execution
- Deployment
- removal on registration dependency
- safety fewer versioning problems
- the end of DLL Hell
13Common Language RuntimeMultiple Language Support
- Common Type System (CTS)
- Common Language Specification (CLS)
14Common Language Specification
- CTS defines a complex set of types
- So a compromise the CLS
- Must implement BOOL, Byte, Char, Integers etc
- Need not implement Uintegers
- Arrays in all languages must have zero as the
lower bound. - All Languages support the same sub set.
15Types Unified Type System
- Value types
- Directly contain data
- Cannot be null
- Reference types
- Contain references to objects
- May be null
int i 123 string s "Hello world"
16Types Unified Type System
- Value types
- Primitives int i float x
- Enums enum State Off, On
- Structs struct Point int x,y
- Reference types
- Root object
- String string
- Classes class Foo Bar, IFoo ...
- Interfaces interface IFoo IBar ...
- Arrays string a new string10
- Delegates delegate void Empty()
17Types Unified Type System
18Types Unified Type System
- Benefits of value types
- No heap allocation, less GC pressure
- More efficient use of memory
- Less reference indirection
- Unified type system
- No primitive/object dichotomy
19TypesUnified Type System
- Everything is an object
- All types ultimately inherit from object
- Any piece of data can be stored, transported, and
manipulated with no extra work
object
Stream
Hashtable
int
double
MemoryStream
FileStream
20ARRAY
Myclass objMyClass6
MyClass objMyClass new MyClass6
Which One is Better and WHY?
21Common Language RuntimeCompilation
Source code
C, C, Visual Basic or any .NET language
csc /outmyAssembly.dll /debug /targetlibrary
parceltracker.cs
22Agenda
- What is .Net Framework
- Common Language Runtime
- Assemblies
- Memory management in .Net
- Execution Model
- .Net security Model
- ASP.NET
- ADO.NET
23Agenda
- What is .Net Framework
- Common Language Runtime
- Assemblies
- Memory management in .Net
- Execution Model
- .Net security Model
- ASP.NET
- ADO.NET
24Common Language RuntimeAssemblies
myAssembly.dll
Metadata
IL Managed code
Resources
25Inside an Assembly
26What are Assemblies ?
- Assemblies are the smallest unit of code
distribution, deployment and versioning
Multi File Assembly
Single File Assembly
A.netmodule
Manifest (No Assembly Metadata)
ThisAssembly.dll
ThisAssembly.dll
Manifest
Metadata
Manifest
MSIL
MetaData
MetaData
MSIL
MSIL
B.netmodule
Resources
Resources
Manifest (No Assembly Metadata)
Metadata
MSIL
27Common Language RuntimeMetadata
- Type information
- more complete than IDL / TLB
- automatically bound into assembly
- inseparable
- stored in binary format
- describes every class type
28Common Language RuntimeMetadata in an Assembly
Type Descriptions
Classes Base classes Implemented interfaces Data
members Methods
Assembly Manifest
Name Version Culture
Other assemblies Security permissions Exported
types
29Assembly
Headers
- PE
- CLR
- Metadata (idata,text,etc)
-
- IL
30Common Language RuntimeApplications
- One or more assemblies
- Types Of Assemblies
- Private
- Shared (placed in GAC)
- Different applications may use different versions
of an assembly - easier software updates
- easier software removal
31Assembly Probing
Working Directory(c\) Sub directory(C\Assembly
\) Named path(c\path\..) Named Path
Subdirectory GAC
32Registry Issues
- Versioning ?
- DLL HELL ?
- Side By Side Execution ?
- Installation
- Uninstall
GAC
33Agenda
- What is .Net Framework
- Common Language Runtime
- Assemblies
- Execution Model
- Memory management in .Net
- ASP.NET
- ADO.NET
34Automatic Memory Management
- Garbage collection mechanism
- Implicit Garbage collection
- Explicit Garbage collection
- Idispose Interface
-
35Memory Management
- Garbage collection mechanism
- Implicit Garbage collection
- Explicit Garbage collection
- Idispose Interface
-
Methods Finalize Close Dispose
Data structure Finalizer List Freacheable
Generations Max 3(0,1,2) Weak ref Strong Ref
36Refresher of Classic ASP
- Server Side Pages containing HTML
- Dynamic Pages
- HTML Editors
37ltbody bgColor"00ff00"gt ltform id"Form1"
method"post"gt lt/formgt lt/bodygt
38Refresher of Classic ASP
- Client Side Scripting (VB Script/Java Script)
- Validations
- Checks
- Range Checking
- Date Display
39Problems with Classic ASP
- Blend of HTML (Design) and script (Logic)
- Object Oriented
- Robust / Reusability Problem
- Redundancy
40Architecture of ASP.NET
- Extension is .aspx
- Is Represented by a unique C class
- (Code behind)
- lt_at_ Page Language C CodebehindWebForm1.aspx.
cs . gt
41Architecture of ASP.NET
42Architecture of ASP.NET
43Architecture of ASP.NET
44Architecture of ASP.NET
45ProcessRequest
Page_Load
XXX_Changed
YYY_Clicked
Page_Unload
46Runtime Compilation
47ASP.NET Modular Architecture
ASPNET_WP
HttpHandlers
Pages
Services
ASPNET_STATE
SessionState
HTTP Runtime
Caching
Authent
Sessions
HttpModules
INETINFO
ASPNET_ISAPI
48Categories of WebForm Controls
- 1. Intrinsic Controls
- HTML controls counterparts Buttons, Textbox,
List - 2. Rich Controls
- AdRotator, Calendar
- 3. Data-centril Controls
- DataGrid DataBindings
49Categories of WebForm Controls
- Validation Controls
- CompareValidator
- CustomValidator
- RangeValidator
- RegularExpressionValidator
- RequiredFieldValidator
- ValidationSummary
50ASP.Net Object Model
Request
Server
HttpContext
Application
Session
Response
51ASP.Net Object Model
Request
Server
HttpContext
Application
Session
Response
52ASP.Net Object Model
Request
Server
HttpContext
Application
Session
Response
53ASP.Net Object Model
Request
Server
HttpContext
Application
Session
Response
54ASP.Net Object Model
Request
Server
HttpContext
Application
Session
Response
55ASP.Net Object Model
Request
Server
HttpContext
Application
Session
Response
56 ADO.NET
57Why ADO.NET?
- ADO works great, but
- Requires COM and Windows
- Recordsets dont travel well across the Internet
- Connected behavior is hard to work with
- ADO.NET solves these problems
- Uses XML under the covers for all data transport
- XML has no runtime/transport requirements
- No special code required to marshal across the
Internet - ADO.NET requires new mindset
- All data access disconnected
- All data transport uses XML
58Connected Or Disconnected?
- System.Data namespace contains disconnected set
of objects - DataSet, DataTable, DataRow, and so on
- Specific namespaces (System.Data.OleDb and
System.Data.SqlClient) contain connected objects - SqlDataAdapter/OleDbDataAdapter
- SqlConnection/OleDbConnection
- SqlDataReader/OleDbDataReader
59Connected Or Disconnected?
- With ADO, a fundamental question isWhere is the
data managed? - On the client?
- On the server?
- A mixture of the two?
- The answer in ADO
- it depends on the cursor you are using.
- With ADO.NET
- Data is always on the client (via DataSet) or on
its way to the client (via IDataReader)
60ADO.NET Architecture
Presentation Tier
Windows Forms
MyApp.Exe
DataSet
Business Tier
Data Tier
InternetIntranet
Web Forms
Data Object (Class)
IE
Data Adapter
DataSet
XML
DataSet
Data Adapter
Business to Business
(BizTalk, for example)
61ADO.NET
ODBC RDBMS
.NET Data Provider
ODBC Driver
ODBC
Connection
OLE DB RDBMS
Command
Application
OLE DB
OLE DB Provider
Data Reader
SQL Server
Data Adapter
62ADO.NET Objects
- Connection
- Connects to data source
- Command
- Executes SELECT, INSERT, UPDATE and DELETE
commands - Data Reader
- Forward-only, read-only stream of data
- Data Adapter
- Connects a DataSet to a data source
63XML SUPPORT
64 WHY MICROSOFT
70M Systems are installed with .NET
65Microsoft Department
Others
66(No Transcript)
67Contact Detail Email Raiyawar_at_gmail.com IM
raiyawar_at_gmail.com Group Groups.msn.com/Innoven
tors