OReilly programming dot NET components 2nd edition jul 2005 ISBN 0596102070

1.2K 158 0
OReilly programming dot NET components 2nd edition jul 2005 ISBN 0596102070

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Programming NET Components By Juval Lowy Publisher: O'Reilly Pub Date: July 2005 ISBN: 0-596-10207-0 Pages: 648 Table of Contents | Index Brilliantly compiled by author Juval Lowy, Programming NET Components, Second Edition is the consummate introduction to the Microsoft NET Framework the technology of choice for building components on Windows platforms From its many lessons, tips, and guidelines, readers will learn how to use the NET Framework to program reusable, maintainable, and robust components Following in the footsteps of its best-selling predecessor, Programming NET Components, Second Edition has been updated to cover NET 2.0 It remains one of the few practical books available on this topic This invaluable resource is targeted at anyone who develops complex or enterprise-level applications with the NET platform an ever-widening market In fact, nearly two million Microsoft developers worldwide now work on such systems Programming NET Components, Second Edition begins with a look at the fundamentals of component-oriented programming and then progresses from there It takes the time to carefully examine how components can simplify and add flexibility to complex applications by allowing users to extend their capabilities Next, the book introduces a variety of NET essentials, as well as NET development techniques Within this discussion on component development, a separate chapter is devoted to each critical development feature, including asynchronous calls, serialization, remoting, security, and more All the while, hazardous programming pitfalls are pointed out, saving the reader from experiencing them the hard way A NET expert and noted authority on component-oriented programming, Lowy uses his unique access to Microsoft technical teams to the best possible advantage, conveying detailed, insider information in easy-to-grasp, activity-filled language This hands-on approach is designed to allow individuals to learn by doing rather than just reading Indeed, after digesting Programming NET Components, Second Edition, readers should be able to start developing NET components immediately Programming NET Components, Second Edition is the consummate introduction to the Microsoft NET Framework the technology of choice for building components on Windows platforms From its many lessons, tips, and guidelines, readers will learn how to use the NET Framework to program reusable, maintainable, and robust components Following in the footsteps of its best-selling predecessor, Programming NET Components, Second Edition has been updated to cover NET 2.0 This invaluable resource is targeted at anyone who develops complex or enterprise-level applications with the NET platform an ever-widening market Programming NET Components By Juval Lowy Publisher: O'Reilly Pub Date: July 2005 ISBN: 0-596-10207-0 Pages: 648 Table of Contents | Index Copyright Preface Scope of This Book Some Assumptions About the Reader Conventions Used in This Book Comments and Questions Safari Enabled Acknowledgments Chapter 1 Introducing Component-Oriented Programming Section 1.1 Basic Terminology Section 1.2 Component-Oriented Versus Object-Oriented Programming Section 1.3 Principles of Component-Oriented Programming Section 1.4 .NET Adherence to Component Principles Section 1.5 Developing NET Components Chapter 2 .NET Component-Oriented Programming Essentials Section 2.1 Language Independence: The CLR Section 2.2 Packaging and Deployment: Assemblies Section 2.3 Binary Compatibility Chapter 3 Interface-Based Programming Section 3.1 Separating Interface from Implementation Section 3.2 Working with Interfaces Section 3.3 Interfaces and Generics Section 3.4 Designing and Factoring Interfaces Section 3.5 Interfaces in Visual Studio 2005 Chapter 4 Lifecycle Management Section 4.1 The Managed Heap Section 4.2 Traditional Memory De-allocation Schemas Section 4.3 .NET Garbage Collection Section 4.4 Object Finalization Section 4.5 Deterministic Finalization Chapter 5 Versioning Section 5.1 Assembly Version Number Section 5.2 Assembly Deployment Models Section 5.3 Strong Assembly Names Section 5.4 Visual Studio 2005 and Versioning Section 5.5 Custom Version Policies Section 5.6 CLR Versioning Chapter 6 Events Section 6.1 Delegate-Based Events Section 6.2 Working with NET Events Chapter 7 Asynchronous Calls Section 7.1 Requirements for an Asynchronous Mechanism Section 7.2 Revisiting Delegates Section 7.3 Asynchronous Call Programming Models Section 7.4 Asynchronous Error Handling Section 7.5 Asynchronous Events Section 7.6 Asynchronous Invocation Pitfalls Section 7.7 Synchronous Versus Asynchronous Processing Chapter 8 Multithreading and Concurrency Management Section 8.1 Threads and Multithreading Section 8.2 Components and Threads Section 8.3 Working with Threads Section 8.4 Synchronizing Threads Section 8.5 Automatic Synchronization Section 8.6 Manual Synchronization Section 8.7 The WorkerThread Wrapper Class Section 8.8 Synchronizing Delegates Section 8.9 Using NET Multithreading Services Chapter 9 Serialization and Persistence Section 9.1 Automatic Serialization Section 9.2 Serialization Formatters Section 9.3 Serialization Events Section 9.4 Serialization and Streams Section 9.5 Custom Serialization Section 9.6 Serialization and Class Hierarchies Chapter 10 Remoting Section 10.1 Application Domains Section 10.2 Remote Object Types Section 10.3 Marshaling-by-Reference Activation Modes Section 10.4 The NET Remoting Architecture Section 10.5 Building a Distributed Application Section 10.6 Leasing and Sponsorship Section 10.7 .NET and Location Transparency Chapter 11 Context and Interception Section 11.1 .NET Component Services Section 11.2 The NET Context Section 11.3 Custom Component Services Chapter 12 Security Section 12.1 The NET Security Architecture Section 12.2 Configuring Permissions Section 12.3 Programmatic Security Section 12.4 Visual Studio 2005 and Security Section 12.5 Principal-Based Security Section 12.6 Addressing Other Security Issues Appendix A Interface-Based Web Services NET Web Services Support Problem Statement Solution Appendix B Unifying Windows Forms and ASP.NET Security ASP.NET Security Infrastructure Solution Architecture The AspNetLoginControl The UserManager Web Service The WSLoginControl The Sample Application Appendix C Reflection and Attributes System.Type Attributes Implementing Custom Attributes Generics and Reflection Appendix D Generics Generics Problem Statement What Are Generics? Generics Implementation Applying Generics Generic Constraints Appendix E C# Coding Standard Naming Conventions and Styles Coding Practices Project Settings and Project Structure Framework-Specific Guidelines Colophon About the Author Colophon Index Programming NET Components, Second Edition by Juval Lưwy Copyright © 2005, 2003 O'Reilly Media, Inc All rights reserved Printed in the United States of America Published by O'Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472 O'Reilly Media, Inc books may be purchased for educational, business, or sales promotional use Online editions are also available for most titles (safari.oreilly.com) For more information, contact our corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com Editor: John Osborn Development Editor: Brian MacDonald Production Editor: Sarah Sherman Cover Designer: Ellie Volckhausen Interior Designer: David Futato Printing History: April 2003: First Edition July 2005: Second Edition Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks of O'Reilly Media, Inc Programming NET Components, Second Edition, the image of a land hermit crab, and related trade dress are trademarks of O'Reilly Media, Inc Microsoft, the NET logo, Visual Basic NET, Visual Studio NET, ADO.NET, Windows, and Windows 2000 are registered trademarks of Microsoft Corporation Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and O'Reilly Media, Inc was aware of a trademark claim, the designations have been printed in caps or initial caps While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein ISBN: 0-596-00762-0 [M] To my daughter, Abigail Preface I've been fortunate in my career to have lived through most generations of Microsoft component technologies In the mid1990s, I developed dynamic link libraries and exported their functions, and I used Microsoft Foundation Class (MFC) extension DLLs to expose classes I experienced firsthand the enormous complexity involved in managing a set of interacting applications comprised of 156 DLLs and deployed as a single unit, as well as the maintenance and versioning issues raised by their use of ordinal numbers I helped design COM-like solutions to those problems, and I remember when I first heard about COM and when I generated my first GUID using a commandline utility I learned how to write class factories and IDL interfaces long before the release of ATL, and I tried to use RPC before DCOM abstracted it away I designed component-based applications using COM and experienced what it takes to share design ideas with other developers who aren't familiar with its requirements I programmed with MTS and learned the workarounds involved in its use, and I marveled at the elegance and usefulness of COM+ when it came to architecting large-scale enterprise frameworks My understanding of component-oriented programming has evolved and grown over that time, just as the component-based technologies themselves have done I have often asked myself what the fundamental principles of using components are, and in what ways they differ from traditional object-oriented programming I have tried to learn from my mistakes and to abstract and generalize the good ideas and techniques I have encountered or developed on my own I believe that I have identified some core principles of component-oriented design that transcend any technologies available today and that result WorkerThread class ThreadStart delegate targets for ThreadState enum type ThreadStateException class 2nd ThreadStatic attribute Timeout class, Infinite static constant 2nd timeouts for waitable handles waiting to join a thread timer period TimerCallback delegate timers choosing a timer System.Threading.Timer class System.Timers.Timer System.Windows.Forms.Timer TimeSpan enum type TimeSpan parameter blocking indefinitely with overloaded Monitor.Wait( ) TimeSpan struct TLBImp utility /unsafe switch TLS (thread local storage) ToString( ) (Type) Transaction attribute making it method-based transaction management service declarative transaction support transaction flow management TransactionalProperty class installation of TransactionSink TransactionAttribute class TransactionScope class consistency bit TransactionScopeOption enum type 2nd TransactionSink class transparent proxy 2nd TransparentProxy class transport channels transport protocols configuring client-side HTTP channel to use in remote object URLs Trojan horses trust named permission sets partial-trust debugging Trust an Assembly wizard Trust Applications (User policy) Trusted Applications (User policy) Trusted Publishers list Trusted Sites zone 2nd Trusted_Same_Site_Access code group Trusted_Zone code group try/catch block, publishing within try/finally statement calling base class implementation of Finalize( ) calls to Enter( ) and Exit( ) (Monitor) TryEnter( ) (Monitor) Type class BaseType property generic reflection members using (example) GetCustomAttributes( ) GetFields( ) GetMethods( ) invoking private object methods other methods ToString( ) type discovery type libraries (COM) type parameter type registration NET programmatic registration of GetObject( ) (Activator) type safety interfaces and SynchronizationAttribute class values type-safe method references 2nd typeof operator use on unbounded generic types Index [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] UI (user interface) permissions configuring demanding for unmanaged code 2nd UIPermission class UML symbol for an interface UnauthenticatedPrincipal value (PrincipalPolicy) UnauthorizedAccessException class unbounded types UNC (universal name convention) undisciplined subscriber problem Union( ) (IPermission) unique identifiers for shared assemblies globally unique (GUIDs) thread ID universal name convention (UNC) Unload( ) (AppDomain) unlocked code, interleaving with locked code unmanaged code access permission, asserting declaratively asserting access permission and demanding UI unnamed slots 2nd unreachable objects, garbage collection of Unregister( ) (ILease) UnregisterChannel( ) (ChannelServices) unsafe code UnsafeFire( ) method Unsubscribe( ) Untrusted Certificates list Untrusted Sites zone default permissions untrusted sites, preventing code execution from unverified certificates Unwrap( ) (IObjectHandle) UpgradeToWriterLock( ) (ReaderWriterLock) URIs client-side type registration host type registration 2nd server-activated objects hosted in IIS URL evidence UrlAttribute class UrlIdentityPermission class URLs activation URL for object registration client-side type registration 2nd for remote objects host type registration Local Intranet security zone, identifying as user authorization user groups (Windows), drawbacks to User security policy configuring default configuration full trust permissions for CLR assemblies storage in XML-formatted file Trust Applications node Trusted Applications node user-oriented security model UserManager web service (example) usernames, obtaining from principal object using statements 2nd aliasing particular combination of specific names generics and interfaces and Index [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] verifiable code verification of code, skipping verified certificates Version class version control version numbers, solution-wide VersionAdded field versioning 2nd assemblies as basic unit assembly deployment models assembly manifests and assembly version numbers class library components ClickOnce applications, security and CLR side-by-side execution specifying CLR version version unification custom version policy application custom policies global custom policies DLL Hell and DLLs serialization and serialization events and type-version tolerance strong assembly names friend assemblies installing shared assembly private assemblies signing your assembly Visual Studio 2005 visibility modifiers component interfaces Visual Basic choosing between C# and My object Visual Basic 2005 events interface (reserved word) Visual Basic.NET Visual Studio 2005 assemblies and assembly host assembly information files assembly version number, automating parts automating system service development breakpoint filters built-in Designer support for Windows Forms Timer Class Library project CLR version 2.0 CLR-compliant languages 2nd configuration files interface-based web service, creating interfaces refactoring metadata, uses of multi-module assemblies security calculating required permissions ClickOnce permissions partial-trust debugging versioning specific reference version void return type for event delegates volatile fields VolatileRead( ) (Thread) VolatileWrite( ) (Thread) Index [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] wait queue Wait( ) Monitor class 2nd Rendezvous class WorkerThread class waitable events monitors vs WaitAll( ) (WaitHandle) 2nd WaitAny( ) (WaitHandle) 2nd WaitCallback delegate WaitForMultipleObjects( ) WaitHandle class 2nd apartment threading models and ManualResetEvent class Monitor vs Mutex class derived from Semaphore class derived from signal-and-wait methods SignalAndWait( ) signaled and non-signaled states single and multiple handles waiting WaitAny( ) waiting for asynchronous call completion waiting thread, awakening by calling Interrupt( ) WaitOne( ) (WaitHandle) 2nd 3rd specifying a timeout watchdogs web services 2nd NET support asynchronous call with completion callback asynchronous methods client-side steps problem statement proxy classes remoting vs server-side steps solution UserManager (example) web.config file WebMethod attribute WebServiceBinding attribute well-known objects client-side type registration WellKnownObjectMode enum type white-box reuse of code 2nd Win32 APIs CreateWaitableTimer( ) MessageBoxA WaitForMultipleObjects( ) Windows asynchronous COM, Windows 2000 debugging, thread IDs and role-based security in security model, Windows NT user groups Win32 native waitable handle Windows Forms asynchronous calls and client using SponsorshipManager (example) custom authentication and authorization ISynchronizeInvoke and thread-safe access to label LoginControl class LoginDialog class (example) partial classes singleton application STAThread attribute System.Timers.Timer used in TestClient project timer using BackgroundWorker for asynchronous call to web service WSLoginControl code access security and MDI application using (example) Windows Forms EXE, LogbookHost project WindowsBuiltInRole enum type WindowsIdentity objects WindowsPrincipal class WindowsPrincipal value (PrincipalPolicy) WM_TIMER Windows message work unit, dispatching to thread pool worker threads WorkerThread class 2nd creating and starting worker thread joining with thread handle terminating worker threads WorkItem class worms Write( ) (Stream) WSDL WSDL.exe command-line utility WSLoginControl code access security and Windows Forms application using Index [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] XML custom permission sets security configuration files security elements, converting permissions to/from serialization Index [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] Zone evidence ZoneIdentityPermission class zones, security settings for ... First Edition July 2005: Second Edition Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks of O'Reilly Media, Inc Programming NET Components, Second Edition, the image of a... Framework-Specific Guidelines Colophon About the Author Colophon Index Programming NET Components, Second Edition by Juval Lưwy Copyright © 2005, 2003 O'Reilly Media, Inc All rights reserved Printed in the United States of America... anyone who develops complex or enterprise-level applications with the NET platform an ever-widening market Programming NET Components By Juval Lowy Publisher: O'Reilly Pub Date: July 2005 ISBN: 0-596-10207-0 Pages: 648 Table of Contents | Index

Ngày đăng: 26/03/2019, 16:32

Mục lục

    Scope of This Book

    Some Assumptions About the Reader

    Conventions Used in This Book

    Section 1.2.  Component-Oriented Versus Object-Oriented Programming

    Section 1.3.  Principles of Component-Oriented Programming

    Section 1.4.  .NET Adherence to Component Principles

    Chapter 2.  .NET Component-Oriented Programming Essentials

    Section 2.1.  Language Independence: The CLR

    Section 2.2.  Packaging and Deployment: Assemblies

    Section 3.1.  Separating Interface from Implementation

Tài liệu cùng người dùng

  • Đang cập nhật ...