Introducing Microsoft.NET 2nd Edition.pdf

(6632 KB) Pobierz
755479993.001.png
Introducing Microsoft .NET, Second Edition
755479993.002.png
Table of Contents
Introducing Microsoft .NET, Second Edition..................................................................................1
Preface................................................................................................................................................3
Chapter 1: Introduction.....................................................................................................................6
The Big Internet.......................................................................................................................6
Raising the Bar: Common Infrastructure Problems.................................................................6
The Best Laid Plans.................................................................................................................8
What the Heck Is .NET, Anyway?............................................................................................9
About This Book.....................................................................................................................10
Sing a Song of Silicon............................................................................................................11
Chapter 2: .NET Objects..................................................................................................................13
Problem Background.............................................................................................................13
Solution Architecture..............................................................................................................15
Oh Yeah? What Does It Cost?.........................................................................................17
Simplest Example..................................................................................................................18
More on .NET Namespaces...................................................................................................21
Assemblies.............................................................................................................................23
Concept of an Assembly..................................................................................................23
Assemblies and Deploymen............................................................................................25
Assemblies and Versioning..............................................................................................28
Object−Oriented Programming Features...............................................................................32
Inheritance.......................................................................................................................33
Object Constructors.........................................................................................................37
.NET Memory Managemen...................................................................................................38
Interoperation with COM........................................................................................................43
Using COM Objects from .NET........................................................................................43
Using .NET Objects from COM........................................................................................46
Transactions in .NET.............................................................................................................48
Structured Exception Handling..............................................................................................50
Code Access Security............................................................................................................54
Chapter 3: ASP.NET........................................................................................................................63
Problem Background.............................................................................................................63
Solution Architecture..............................................................................................................65
Simplest Example: Writing a Simple ASP.NET Page............................................................67
More on Web Controls...........................................................................................................70
Managing and Configuring Web Application Projects: The Web.config File..........................75
ASP.NET State Management................................................................................................77
Security in ASP.NET..............................................................................................................82
Authentication..................................................................................................................82
Authorization....................................................................................................................90
Identity.............................................................................................................................95
Process Management............................................................................................................96
Chapter 4: .NET Web Services.......................................................................................................98
Problem Background.............................................................................................................98
Solution Architecture............................................................................................................100
Simplest Example: Writing an XML Web Service................................................................102
i
Table of Contents
Chapter 4: .NET Web Services
Self−Description of XML Web Services: The WSDL File.....................................................105
Writing XML Web Service Clients........................................................................................107
XML Web Service Support in Visual Studio .NET................................................................112
XML Web Service Design Considerations...........................................................................114
Make Them Chunky.......................................................................................................114
Think Carefully About Their State..................................................................................115
Handling Exceptions......................................................................................................117
Replacing the Namespace UR......................................................................................118
XML Web Service Security............................................................................................119
Chapter 5: Windows Forms..........................................................................................................122
Problem Background...........................................................................................................122
Solution Architecture............................................................................................................123
Simplest Example................................................................................................................124
More Complex Example: Controls and Events....................................................................126
Hosting ActiveX Controls in Windows Forms.......................................................................128
Form Enhancements............................................................................................................131
Drawing..........................................................................................................................132
Mouse Handling.............................................................................................................134
Menu Handling...............................................................................................................134
Keyboard Handling.........................................................................................................136
Dialog Boxes..................................................................................................................137
Chapter 6: Data Access in .NET...................................................................................................138
Problem Background...........................................................................................................138
Solution Architecture............................................................................................................139
Simplest Example................................................................................................................142
More Complex Example: Disconnected Operation..............................................................145
Visual Studio Support and Typed DataSet Objects.............................................................151
Chapter 7: Handling XML..............................................................................................................158
Problem Background...........................................................................................................158
Solution Architecture............................................................................................................160
Simplest Example: Basic Serialization.................................................................................160
More Complex Example: Controlling Serialization...............................................................163
XML Schemas and Serialization..........................................................................................167
Generic Parsing...................................................................................................................169
Chapter 8: Events and Delegates.................................................................................................172
Problem Background...........................................................................................................172
Solution Architecture............................................................................................................173
Simplest Example................................................................................................................174
More Complex Example.......................................................................................................179
Delegates.............................................................................................................................182
Chapter 9: Threads........................................................................................................................187
Overview..............................................................................................................................187
Problem Background...........................................................................................................187
Solution Architecture............................................................................................................188
ii
Table of Contents
Chapter 9: Threads
Simplest Threading Example: Using The Process Thread Pool..........................................190
More Complex Example: Thread Safety..............................................................................194
Still More Complex Example: Managing Your Own Threads...............................................201
Chapter 10: Windows Forms Controls........................................................................................204
Problem Background...........................................................................................................204
Solution Architecture............................................................................................................205
Simplest Control Example....................................................................................................206
More Complex Example: Extending an Existing Control.....................................................211
User Control Example: Containing Other Controls..............................................................213
Chapter 11: Web Forms Controls.................................................................................................217
Problem Background...........................................................................................................217
Solution Architecture............................................................................................................217
Simplest Web Forms Control Example................................................................................220
More Complex Web Forms Example...................................................................................223
View State Managemen......................................................................................................228
Client−Side Scripting...........................................................................................................229
Epilogue and Benediction.............................................................................................................233
List of Figures................................................................................................................................235
List of Tables..................................................................................................................................241
List of Sidebars..............................................................................................................................242
iii
Zgłoś jeśli naruszono regulamin