Smith Nguyen Studio.
.NET Framework Essentials
Thuan Thai
Hoang Q. Lam
Publisher: O'Reilly
First Edition June 2001
ISBN: 0-596 -00165-7, 320 pages
Smith Nguyen Studio.
Preface............................................................................................................................6
Audience ...................................................................................................................6
About This Book.....................................................................................................6
Assumptions This Book Makes .........................................................................7
Conventions Used in This Book........................................................................7
How to Contact Us ................................................................................................8
Acknowledgments .................................................................................................8
Chapter 1. .NET Overview .........................................................................................10
1.1 Microsoft .NET ...............................................................................................10
1.2 The .NET Platform .......................................................................................11
1.3 .NET F ramework Design Goals ...............................................................12
1.4 .NET Framework ..........................................................................................15
Chapter 2. The Common Language Runtime.........................................................17
2.1 CLR Environment.........................................................................................17
2.2 CLR Executables...........................................................................................17
2.3 Metadata.........................................................................................................21
2.4 Assemblie s and Manifests ........................................................................26
2.5 Intermediate Language (IL)....................................................................31
2.6 The CTS and CLS.........................................................................................33
2.7 CLR Execution...............................................................................................37
2.8 Summary ........................................................................................................40
Chapter 3. .NET Programming..................................................................................42
3.1 Common Programmin g Model................................................................42
3.2 Core Features and Languages ................................................................44
3.3 Language Integration................................................................................55
3.4 Summary ........................................................................................................59
Chapter 4. Working with .NET Components ...........................................................61
4.1 Deployment Options...................................................................................61
4.2 Distributed Components...........................................................................69
4.3 COM+ Services in .NET.............................................................................72
4.4 Message Queuing ........................................................................................82
4.5 Summary ........................................................................................................84
Chapter 5. Data and XML ..........................................................................................85
5.1 ADO.NET Architecture ...............................................................................85
5.2 ADO.NET Benefits........................................................................................86
5.3 Content Components .................................................................................88
5.4 Managed Providers .....................................................................................98
5.5 DataSet and XML.......................................................................................107
5.6 Summary ......................................................................................................115
Chapter 6. Web Services .........................................................................................117
6.1 Web Services in Practice ........................................................................117
6.2 Web Services Framework.......................................................................118
6.3 Web Services Provider.............................................................................127
6.4 Web Services Consumers.......................................................................131
6.5 Web Services and Security....................................................................146
6.6 Summary ......................................................................................................148
2
Smith Nguyen Studio.
.NET Framework Essentials
Chapter 7. Web Forms............................................................................................. 149
7.1 ASP.................................................................................................................. 149
7.2 ASP.NET........................................................................................................ 149
7.3 The System.Web.UI Namespace......................................................... 150
7.4 Web Form Syntax ..................................................................................... 156
7.5 ASP.NET Application Development..................................................... 161
7.6 ASP.NET and Web Services................................................................... 173
7.7 Data Binding and the Use of Templates........................................... 175
7.8 State Management and Scalability..................................................... 180
7.9 Summary ...................................................................................................... 182
Chapter 8. Windows Forms..................................................................................... 183
8.1 Introducing Windows Forms.................................................................183
8.2 The System.Windows.Forms Namespace........................................ 184
8.3 Windows Forms Development.............................................................. 188
8.4 Windows Forms and Web Services.................................................... 205
8.5 Conclusion.................................................................................................... 205
Appendix A. .NET Languages................................................................................. 207
A.1 Microsoft-Supported Languages for .NET........................................ 207
A.2 Third-Party Languages for .NET .......................................................... 207
Appendix B. Common Acronyms............................................................................ 209
Appendix C. Common Datatypes ........................................................................... 213
C.1 Usage............................................................................................................. 214
Appendix D. Common Utilities ................................................................................ 218
D.1 Assembly Generation U tility (al.exe)................................................ 218
D.2 Assembly Registration Utility (gac.exe) .......................................... 219
D.3 MSIL Assembler (ilasm.exe)................................................................ 219
D.4 MSIL Disassembler (ildasm.exe)........................................................ 220
D.5 C++ Compiler (cl.exe) ........................................................................... 220
D.6 C# Compiler (csc.exe)............................................................................ 220
D.7 Visual Basic Compiler (vbc.exe)......................................................... 221
D.8 PE File Format Viewer (dumpbin.exe).............................................. 221
D.9 Type Library Exporter (tlbexp.exe) ................................................... 222
D.10 Type Library Importer (tlbimp.exe)................................................ 222
D.11 XML Schema Definition Tool (xsd.exe).......................................... 222
D.12 Shared Name Utility (sn.exe)............................................................ 224
D.13 Web Service Utility (wsdl.exe).......................................................... 224
Colophon.................................................................................................................... 225
3
Smith Nguyen Studio.
.NET Framework Essentials
Preface
Audience
About This Book
Assumptions This Book Makes
Conventions Used in This Book
How to Contact Us
Acknowledgments
1. .NET Overview
1.1 Microsoft .NET
1.2 The .NET Platform
1.3 .NET Framework Design Goals
1.4 .NET Framework
2. The Common Language Runtime
2.1 CLR Environment
2.2 CLR Executables
2.3 Metadata
2.4 Assemblies and Manifests
2.5 Intermediate Language (IL)
2.6 The CTS and CLS
2.7 CLR Execution
2.8 Summary
3. .NET Programming
3.1 Common Programming Model
3.2 Core Features and Languages
3.3 Language Integration
3.4 Summary
4. Working with .NET Components
4.1 Deployment Options
4.2 Distributed Components
4.3 COM+ Services in .NET
4.4 Message Queuing
4.5 Summary
5. Data and XML
5.1 ADO.NET Architecture
5.2 ADO.N ET Benefits
5.3 Content Components
5.4 Managed Providers
5.5 DataSet and XML
5.6 Summary
6. Web Services
6.1 Web Services in Practice
6.2 Web Services Framework
6.3 Web Services Provider
6.4 Web Services Consumers
6.5 Web Services and Security
6.6 Summary
4
Smith Nguyen Studio.
.NET Framework Essentials
7. Web Forms
7.1 ASP
7.2 ASP.NET
7.3 The System.Web.UI Namespace
7.4 Web Form Syntax
7.5 ASP.NET Application Development
7.6 ASP.NET and Web Services
7.7 Data Bin ding and the Use of Templates
7.8 State Management and Scalability
7.9 Summary
8. Windows Forms
8.1 Introducing Windows Forms
8.2 The System.Windows.Forms Namespace
8.3 Windows Forms Development
8.4 Windows Forms and Web Services
8.5 Conclusion
A. .NET Languages
A.1 Microsoft-Supported Languages for .NET
A.2 Third -Party Languages for .NET
B. Common Acronyms
C. Common Datatypes
C.1 Usage
D. Common Utilities
D.1 Assembly Generation Utility (al.exe)
D.2 Assembly Registration Utility (gac.exe)
D.3 MSIL Assembler (ilasm.exe)
D.4 MSIL Disassembler (ildasm.exe)
D.5 C++ Compiler (cl.exe)
D.6 C# Compiler (csc.exe)
D.7 Visual Basic Compiler (vbc.exe)
D.8 PE File Format Viewer (dumpbin.exe)
D.9 Type Library Exporter (tlbexp.exe)
D.10 Type Library Importer (tlbimp.exe)
D.11 XML Schema Definition Tool (xsd.exe)
D.12 Shared Name Utility (sn.exe)
D.13 Web Service Utility (wsdl.exe)
Colophon
.NET Framework Essentials is a concise and technical overview of the new Microsoft .NET Framework.
Covered here are all of the most important topics—from the underlying Common Language Runtime
(CLR) to its speci alized packages for ASP.NET, Web Forms, Windows Forms, XML and data access
(ADO.NET). The authors survey each of the major .NET languages, including VB.NET, C# and
Managed C++.
5
.NET Framework Essentials
Colophon
Our look is the result of reader comments, our own experimentation, and feedback from distribution
channels. Distinctive covers complement our distinctive approach to technical topics, b reathing
personality and life into potentially dry subjects.
The animals on the cover of .NET Framework Essentials are shrimp. The 2,000 species of shrimp
range in size from fractions of an inch to 8 inches-with an average size of about 4 inches. Like other
crustaceans (including lobsters, crabs, crayfish, and barnacles), the shrimp has a segmented body
covered by a hard, translucent exoskeleton, has a flexible abdomen and fan-shaped tail, and utilizes a
"toolkit" of jointed appendages-each with specialized functions for various activities. The shrimp's
exoskeleton, while providing a strong protective layer over its body, must be shed occasionally to allow
for growth in a process called molting. Similar to this process of regrowth, lost appendages can be
regenerated if need be.
Different species of shrimp are found in marine and fresh water--shallow and deep--all over the world.
Swimming backward by rapidly flexing its abdomen and tail, and with the assistance of specialized
legs for swimming, the shrimp feeds on smaller plants and animals, as well as carrion. In fact, several
species engage in symbiotic (mutually benefical or dependent) relationships with other organisms. The
coral shrimp (Stenopus hispidus) cleans the scales of the coral fish, while the fish in turn swims
backward through the shrimp's pincers (presumably to clean them). In addition, species of Alpheus
shrimp share burrows with blind goby fish. The shrimp brings food to the goby, while the goby cleans
the burrow and warns the shrimp of danger by using signaled body movements.
Interestingly, certain species of shrimp are hermaphroditic. The juvenile shrimp grows up as a male
and is fully functional in sexual reproduction with females. When it reaches half the size of the female,
the male shrimp loses its male sexual organs and develops those of the female. Upon reaching full
size, the shrimp is then a typical female and is fully able to mate again. However, this time it mates
with a juvenile male, rather than with an adult female as before.
Jeffrey Holcomb was the production editor and copyeditor for .NET Framework Essentials. Mary Brady
and Claire Cloutier provided quality control. Sada Preisch and Edie Shapiro provided production
assistance. Joe Wizda wrote the index.
Ellie Volckhausen designed the cover of this book, based on a series design by Edie Freedman. The
cover image is a 19th-century engraving from the Dover Pictorial Archive. Emma Colby produced the
cover layout with Quark™XPress 4.1 using Adobe's ITC Garamond font.
David Futato designed the interior layout based on a series design by Nancy Priest. Anne-Marie
Vaduva converted the files from Microsoft Word to FrameMaker 5.5.6 using tools created by Mike
Sierra. The text and heading fonts are ITC Garamond Light and Garamond Book; the code font is
Constant Willison. The illustrations that appear in the book were produced by Robert Romano and
Jessamyn Read using Macromedia FreeHand 9 and Adobe Photoshop 6. This colophon was written
by Jeffrey Holcomb.
225
226