Home Page Icon
Home Page
Table of Contents for
Programming .NET Components, 2nd Edition
Close
Programming .NET Components, 2nd Edition
by Juval Lowy
Programming .NET Components, 2nd Edition
Programming .NET Components, 2nd Edition
Dedication
A Note Regarding Supplemental Files
Preface
Scope of This Book
Some Assumptions About the Reader
Conventions Used in This Book
Comments and Questions
Safari Enabled
Acknowledgments
1. Introducing Component-Oriented Programming
1.1. Basic Terminology
1.2. Component-Oriented Versus Object-Oriented Programming
1.2.1. Building Blocks Versus Monolithic Applications
1.2.2. Interfaces Versus Inheritance
1.3. Principles of Component-Oriented Programming
1.3.1. Separation of Interface from Implementation
1.3.2. Binary Compatibility Between Client and Server
1.3.3. Language Independence
1.3.4. Location Transparency
1.3.5. Concurrency Management
1.3.6. Versioning Support
1.3.7. Component-Based Security
1.4. .NET Adherence to Component Principles
1.5. Developing .NET Components
1.5.1. The .NET Base Classes
1.5.2. Declarative Programming
1.5.3. Component-Oriented Security
1.5.4. Simplified Deployment
2. .NET Component-Oriented Programming Essentials
2.1. Language Independence: The CLR
2.1.1. Intermediate Language and the JIT Compiler
2.1.2. .NET Programming Languages
2.1.3. .NET Components Are Language-Independent
2.1.4. Choosing a .NET Language
2.2. Packaging and Deployment: Assemblies
2.2.1. DLLs and COM Components
2.2.2. .NET Assemblies
2.2.3. Assemblies and Visual Studio 2005
2.2.3.1. Partial types
2.2.3.2. Adding a reference
2.2.3.3. The reference path
2.2.3.4. Aliasing a reference
2.2.3.5. The Visual Studio 2005 assembly host
2.2.4. Client and Server Assemblies
2.2.5. Managing Component Visibility in Assemblies
2.2.6. Assembly Metadata
2.2.7. The Assembly Manifest
2.2.8. Friend Assemblies
2.2.9. Composing Assemblies
2.2.10. The Assembly Type
2.3. Binary Compatibility
2.3.1. COM Binary Compatibility
2.3.2. .NET Binary Compatibility
2.3.3. Binary Inheritance
3. Interface-Based Programming
3.1. Separating Interface from Implementation
3.1.1. Interface Implementation
3.1.2. Explicit Interface Implementation
3.2. Working with Interfaces
3.2.1. Interfaces and Type Safety
3.2.2. Interface Methods, Properties, and Events
3.2.3. Interfaces and Structs
3.2.4. Interfaces and Partial Types
3.2.5. Implementing Multiple Interfaces
3.2.6. Interfaces and Class Hierarchies
3.3. Interfaces and Generics
3.3.1. Deriving from a Generic Interface
3.3.2. Explicit Generic Interface Implementation
3.3.3. Generic Interfaces as Operators
3.3.4. Interface-Level Constraints
3.3.5. Generic Derivation Constraints
3.3.6. Generics, Interfaces, and Casting
3.3.7. Generic Interface Methods
3.4. Designing and Factoring Interfaces
3.4.1. Interface Factoring
3.4.2. Factoring Metrics
3.5. Interfaces in Visual Studio 2005
3.5.1. Interface Refactoring
4. Lifecycle Management
4.1. The Managed Heap
4.2. Traditional Memory De-allocation Schemas
4.3. .NET Garbage Collection
4.4. Object Finalization
4.4.1. Explicit Garbage Collection
4.4.2. Finalize() Method Implementation
4.5. Deterministic Finalization
4.5.1. The Open/Close Pattern
4.5.2. The Dispose() Pattern
4.5.3. The IDisposable Pattern
4.5.4. Disposing and Error Handling
4.5.4.1. The using statement and interfaces
4.5.4.2. The using statements and generics
4.5.5. Dispose() and Finalize()
4.5.6. Deterministic Finalization Template
5. Versioning
5.1. Assembly Version Number
5.1.1. Version Number Elements
5.1.2. Providing the Version Number
5.2. Assembly Deployment Models
5.3. Strong Assembly Names
5.3.1. Signing Your Assembly
5.3.1.1. Generating a strong name key file
5.3.1.2. Selecting an existing strong name key file
5.3.1.3. Handling large organizations’ keys
5.3.2. Strong Names and Private Assemblies
5.3.3. Friend Assemblies and Strong Names
5.3.4. Installing a Shared Assembly
5.3.4.1. Verifying shared assembly mode
5.3.4.2. Side-by-side execution
5.4. Visual Studio 2005 and Versioning
5.4.1. Specific Reference Version
5.5. Custom Version Policies
5.5.1. Application Custom Policies
5.5.1.1. Custom version-binding policies
5.5.1.2. Custom codebase policies
5.5.1.3. Application configuration file
5.5.2. Global Custom Policies
5.6. CLR Versioning
5.6.1. CLR Side-by-Side Execution
5.6.2. Version Unification
5.6.3. Specifying a CLR Version
5.6.3.1. Default version binding
5.6.3.2. Specifying supported CLR versions
6. Events
6.1. Delegate-Based Events
6.1.1. Delegate Inference
6.1.2. Generic Delegates
6.1.3. The event Keyword
6.1.4. Events in Visual Basic 2005
6.2. Working with .NET Events
6.2.1. Defining Delegate Signatures
6.2.2. Defining Custom Event Arguments
6.2.3. The Generic Event Handler
6.2.4. Publishing Events Defensively
6.2.4.1. The EventsHelper class
6.2.4.2. Making EventsHelper type-safe
6.2.5. Event Accessors
6.2.6. Managing Large Numbers of Events
6.2.7. Writing Sink Interfaces
7. Asynchronous Calls
7.1. Requirements for an Asynchronous Mechanism
7.2. Revisiting Delegates
7.3. Asynchronous Call Programming Models
7.3.1. Using BeginInvoke() and EndInvoke()
7.3.1.1. The IAsyncResult interface
7.3.1.2. The AsyncResult class
7.3.1.3. Polling or waiting for completion
7.3.2. Using Completion Callback Methods
7.3.2.1. Callback methods and thread safety
7.3.2.2. Passing state information
7.3.3. Performing Asynchronous Operations Without Delegates
7.4. Asynchronous Error Handling
7.5. Asynchronous Events
7.5.1. Asynchronous EventsHelper
7.5.1.1. Type-safe asynchronous EventsHelper
7.6. Asynchronous Invocation Pitfalls
7.6.1. Threading Concurrency and Synchronization
7.6.2. Thread-Pool Exhaustion
7.6.3. Premature Access by Reference and Reference Types
7.6.4. Lengthy Constructors
7.6.5. Cleaning Up After EndInvoke
7.7. Synchronous Versus Asynchronous Processing
8. Multithreading and Concurrency Management
8.1. Threads and Multithreading
8.2. Components and Threads
8.3. Working with Threads
8.3.1. Creating Threads
8.3.1.1. Designing thread methods
8.3.2. Blocking Threads
8.3.2.1. Suspending and resuming a thread
8.3.2.2. Putting a thread to sleep
8.3.2.3. Spinning while waiting
8.3.2.4. Joining a thread
8.3.2.5. Interrupting a waiting thread
8.3.3. Aborting a Thread
8.3.4. Thread States
8.3.5. Foreground and Background Threads
8.3.6. Thread Priority and Scheduling
8.4. Synchronizing Threads
8.5. Automatic Synchronization
8.5.1. Synchronization Domains
8.5.2. Synchronization Domains and Contexts
8.5.3. Configuring Synchronization Domains
8.5.3.1. Synchronization NOT_SUPPORTED
8.5.3.2. Synchronization SUPPORTED
8.5.3.3. Synchronization REQUIRED
8.5.3.4. Synchronization REQUIRES_NEW
8.5.3.5. Choosing between REQUIRED and REQUIRES_NEW
8.5.4. Synchronization-Domain Reentrancy
8.5.5. Synchronization Domain Pros and Cons
8.6. Manual Synchronization
8.6.1. The Monitor
8.6.1.1. Protecting static members and methods
8.6.1.2. Error handling
8.6.1.3. Encapsulating Monitor
8.6.1.4. Thread-safe structures
8.6.1.5. Monitor and generics
8.6.1.6. Synchronized methods
8.6.1.7. Waiting and signaling with Monitor
8.6.2. Waitable Handles
8.6.2.1. Using WaitHandle
8.6.2.2. WaitHandle versus Monitor
8.6.3. The Mutex
8.6.3.1. Using a mutex
8.6.3.2. Named mutexes
8.6.4. Waitable Events
8.6.4.1. Manual-reset events
8.6.4.2. Auto-reset events
8.6.4.3. Waitable events versus monitors
8.6.4.4. Thread rendezvous example
8.6.5. The Semaphore
8.6.6. The Interlocked
8.6.7. The Reader/Writer Lock
8.7. The WorkerThread Wrapper Class
8.7.1. Launching a New Worker Thread
8.7.2. Joining WorkerThread and the Thread Handle
8.7.3. Terminating the Worker Thread
8.8. Synchronizing Delegates
8.9. Using .NET Multithreading Services
8.9.1. Thread-Relative Static Variables
8.9.2. Thread Local Storage
8.9.2.1. Using a named slot
8.9.2.2. Using an unnamed slot
8.9.3. The Thread Pool
8.9.3.1. Configuring the thread pool
8.9.4. ISynchronizeInvoke
8.9.4.1. Using ISynchronizeInvoke
8.9.4.2. Windows Forms and ISynchronizeInvoke
8.9.4.3. Events and ISynchronizeInvoke
8.9.4.4. Implementing ISynchronizeInvoke
8.9.5. Windows Forms and Asynchronous Calls
8.9.5.1. Web service proxy classes
8.9.6. Timers
8.9.6.1. System.Timers.Timer
8.9.6.2. System.Threading.Timer
8.9.6.3. System.Windows.Forms.Timer
8.9.6.4. Choosing a timer
8.9.7. Volatile Fields
8.9.8. .NET and COM’s Apartments
9. Serialization and Persistence
9.1. Automatic Serialization
9.1.1. The Serializable Attribute
9.1.2. Non-Serializable Members
9.1.2.1. Delegates and serialization
9.2. Serialization Formatters
9.2.1. The Binary Formatter
9.2.2. The SOAP Formatter
9.2.3. Generic Formatters
9.2.4. Serialization of Generic Type Parameters
9.3. Serialization Events
9.3.1. Applying the Event Attributes
9.3.2. Serialization Events and Class Hierarchies
9.3.2.1. Using the deserializing event
9.3.2.2. Using the deserialized event
9.3.3. Serialization and Versioning
9.3.4. Type-Version Tolerance
9.4. Serialization and Streams
9.4.1. Serializing Multiple Objects
9.5. Custom Serialization
9.5.1. The ISerializable Interface
9.5.2. Implementing ISerializable
9.5.2.1. GenericSerializationInfo
9.5.2.2. Custom serialization and IDeserializationCallback
9.5.2.3. Custom serialization and serialization events
9.5.3. Constraining Serialization
9.6. Serialization and Class Hierarchies
9.6.1. Custom Serialization and Base Classes
9.6.2. Manual Base-Class Serialization
10. Remoting
10.1. Application Domains
10.1.1. App Domains Versus Physical Processes
10.1.2. App Domains and the .NET Platform
10.1.2.1. App domains and threads
10.1.3. App Domains and Remoting
10.1.4. The AppDomain Class
10.1.4.1. The default app domain
10.1.4.2. Creating objects in app domains
10.1.4.3. Creating a new app domain
10.1.4.4. Unwrapping remote objects
10.1.5. The Host App Domain
10.2. Remote Object Types
10.2.1. Marshaling by Value
10.2.2. Marshaling by Reference
10.3. Marshaling-by-Reference Activation Modes
10.3.1. Client-Activated Object
10.3.2. Server-Activated Single Call
10.3.2.1. Benefits of single-call objects
10.3.2.2. Designing a single-call object
10.3.2.3. Applying the single-call mode
10.3.3. Server-Activated Singleton
10.3.3.1. Using singleton objects
10.3.3.2. Singleton object lifecycle
10.3.4. Activation Modes and Synchronization
10.3.4.1. Client-activated objects and synchronization
10.3.4.2. Single-call objects and synchronization
10.3.4.3. Singleton objects and synchronization
10.4. The .NET Remoting Architecture
10.4.1. Client-Side Processing
10.4.2. Server-Side Processing
10.4.3. Formatters
10.4.4. Transport Channels
10.4.5. Object Locations and Identity
10.4.6. Error Handling
10.5. Building a Distributed Application
10.5.1. Programmatic Channel Registration
10.5.1.1. Host channel registration
10.5.1.2. Channels and formats
10.5.2. Programmatic Type Registration
10.5.2.1. Host type registration
10.5.2.2. Client-side type registration
10.5.3. Programmatic Configuration Example
10.5.4. Administrative Configuration
10.5.4.1. Visual Studio 2005 and configuration files
10.5.5. Administrative Channel Registration
10.5.5.1. Host channels registration
10.5.5.2. Channels and formats
10.5.6. Administrative Type Registration
10.5.6.1. Host type registration
10.5.6.2. Client-side type registration
10.5.7. Administrative Configuration Example
10.5.8. Creating Remote Objects
10.5.8.1. RemotingServices.Connect()
10.5.8.2. Activator.GetObject()
10.5.8.3. Activator.CreateInstance()
10.5.8.4. Creating remote generic objects
10.5.9. Remote Callbacks
10.5.9.1. Registering callback channels
10.5.9.2. Remote callbacks and type filtering
10.5.9.3. Remote callbacks and metadata
10.5.9.4. Remote callbacks and error handling
10.5.9.5. Remote callback example
10.5.10. Separating the Server Code from its Metadata
10.5.11. Providing a Host as a System Service
10.5.11.1. Hosting with IIS
10.6. Leasing and Sponsorship
10.6.1. Lease Properties
10.6.1.1. Lease manager properties
10.6.1.2. Configuring global default properties
10.6.2. Configuring a Lease
10.6.3. Renewing a Lease
10.6.4. Providing a Sponsor
10.6.4.1. Sponsors and remoting
10.6.4.2. Client and leases
10.6.5. Leasing and Remote Activation Modes
10.6.5.1. Leasing a singleton object
10.6.5.2. Leasing a client-activated object
10.6.6. Sponsorship Management
10.7. .NET and Location Transparency
11. Context and Interception
11.1. .NET Component Services
11.1.1. Contexts and Object Types
11.1.2. Component Services Types
11.2. The .NET Context
11.2.1. Assigning Objects to Contexts
11.2.2. The Call Interception Architecture
11.2.2.1. Cross-context sinks
11.2.2.2. Message sink types
11.2.3. Same-Context Calls
11.2.4. Context-Bound Objects and Remoting
11.3. Custom Component Services
11.3.1. Building a Custom Context Attribute
11.3.2. Installing a Custom Message Sink
11.3.2.1. Providing a server context sink
11.3.2.2. Providing a client context sink
11.3.2.3. Providing an envoy sink
11.3.2.4. Providing an object sink
11.3.2.5. Processing messages
11.3.3. The Logbook Service
11.3.3.1. Using the logbook
11.3.3.2. The logbook service architecture
11.3.3.3. Implementing the logbook
11.3.4. The Transaction Management Service
11.3.4.1. Transaction flow management
11.3.4.2. Declarative transaction support
12. Security
12.1. The .NET Security Architecture
12.1.1. Permissions
12.1.2. Permission Sets
12.1.3. Security Evidence
12.1.3.1. The All Code evidence
12.1.3.2. The Application Directory evidence
12.1.3.3. The GAC evidence
12.1.3.4. The Site evidence
12.1.3.5. The URL evidence
12.1.3.6. The Zone evidence
12.1.3.7. The Strong Name evidence
12.1.3.8. The Hash evidence
12.1.3.9. The Publisher evidence
12.1.3.10. Selecting a security evidence
12.1.4. Code Groups and Security Policies
12.1.4.1. Combining policies
12.1.4.2. Policy levels
12.1.5. How It All Works Together
12.2. Configuring Permissions
12.2.1. .NET Default Configuration
12.2.1.1. The Enterprise and User policies
12.2.1.2. The Machine policy
12.2.2. Custom Permission Sets
12.2.3. Custom Code Groups
12.2.3.1. Non-administrative permissions
12.2.4. Administrating Security for ClickOnce Applications
12.2.4.1. ClickOnce versioning and security
12.2.4.2. Trusting ClickOnce application publishers
12.2.5. Custom Security Policies
12.2.5.1. Custom server-side policy
12.2.5.2. Custom client-side policy
12.2.6. Security Administration Utilities
12.2.6.1. Resetting policies
12.2.6.2. Managing policy files
12.2.6.3. Adjusting security
12.2.6.4. Evaluating an assembly
12.2.6.5. Trusting an assembly
12.2.6.6. Exporting security policies
12.2.7. Security Infrastructure Benefits
12.3. Programmatic Security
12.3.1. The Permission Classes
12.3.1.1. Permission demand
12.3.1.2. Permission interactions
12.3.2. Stack-Walk Modifiers
12.3.2.1. Denying and permitting permissions
12.3.2.2. Asserting permissions
12.3.2.3. Asserting unmanaged code access permission
12.3.3. Permission Attributes
12.3.3.1. Choice actions
12.3.3.2. Link-time demands
12.3.3.3. Inheritance demand
12.3.4. Permission Set Classes
12.3.4.1. Permission set collection
12.3.5. Permission Set Attributes
12.3.6. Assembly-Wide Permissions
12.4. Visual Studio 2005 and Security
12.4.1. ClickOnce Permissions
12.4.2. Calculating Required Permissions
12.4.3. Partial-Trust Debugging
12.4.4. Visual Basic 2005 and Security
12.5. Principal-Based Security
12.5.1. Declarative Role-Based Security
12.5.1.1. Enabling role-based security
12.5.1.2. Role-based security and authentication
12.5.2. Programmatic Role-Based Security
12.5.2.1. Principal and identity
12.5.2.2. Verifying role membership
12.5.3. Windows Security Principal
12.5.4. Custom Security Principal
12.6. Addressing Other Security Issues
12.6.1. Link-Time Demand and Reflection
12.6.2. Link-Time Demand and Inheritance
12.6.3. Strongly Named Assemblies and Full Trust
12.6.4. Unsafe Code
12.6.5. Security and Remote Calls
12.6.6. Serialization
12.6.7. Transactions
A. Interface-Based Web Services
.NET Web Services Support
Problem Statement
Solution
Service-Side Steps
Client-Side Steps
B. Unifying Windows Forms and ASP.NET Security
ASP.NET Security Infrastructure
ASP.NET Custom Authentication and Authorization
Solution Architecture
Implementing IPrincipal
The LoginControl Class
Providing input to LoginControl
Authenticating the user
The AspNetLoginControl
Implementing IUserManager
AspNetLoginControl and Code Access Security
The UserManager Web Service
The WSLoginControl
WSLoginControl and Code Access Security
The Sample Application
The LoginDialog Class
C. Reflection and Attributes
System.Type
Attributes
Using Attributes
Kinds of Attributes
Implementing Custom Attributes
Reflecting Custom Attributes
Generics and Reflection
Attributes and Generics
D. Generics
Generics Problem Statement
What Are Generics?
Generics Implementation
Applying Generics
Multiple Generic Types
Generic Constraints
Derivation Constraint
Constructor Constraint
Class/Struct Type Constraint
E. C# Coding Standard
Naming Conventions and Styles
Coding Practices
Project Settings and Project Structure
Framework-Specific Guidelines
Multithreading
Serialization
Remoting
Security
Colophon
Copyright
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Cover
Next
Next Chapter
Dedication
Programming .NET Components, 2nd Edition
Juval Lowy
Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset