Expert VB 2008 Business Objects

  

  Expert VB 2008

Business Objects

■ ■ ■ Rockford Lhotka with Joe Fallon

Expert VB 2008 Business Objects Copyright © 2009 by Rockford Lhotka

  

All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,

electronic or mechanical, including photocopying, recording, or by any information storage or retrieval

system, without the prior written permission of the copyright owner and the publisher.

  ISBN-13 (pbk): 978-1-4302-1638-4

  ISBN-13 (electronic): 978-1-4302-1639-1 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1

Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence

of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark

owner, with no intention of infringement of the trademark. Editor: Matthew Moodie Technical Reviewers: James Miller, Andrés Villanueva Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Michelle Lowman, Matthew Moodie, Duncan Parkes,

  

Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh

Project Manager: Richard Dal Porto Copy Editor: Kim Wimpsett Associate Production Director: Kari Brooks-Copony Production Editor: Laura Cheu Compositor: Susan Glinert Stevens Proofreader: Kim Burton Indexer: John Collin Artist: April Milne Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski

Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor,

New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail , or

  [email protected] visit http://www.springeronline.com .

  For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected] , or visit http://

  www.apress.com .

  

Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use.

eBook versions and licenses are also available for most titles. For more information, reference our Special

Bulk Sales–eBook Licensing web page at .

  http://www.apress.com/info/bulksales

  

The information in this book is distributed on an “as is” basis, without warranty. Although every precaution

has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to

any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly

by the information contained in this work.

  The source code for this book is available to readers at http://www.apress.com .

  To my mom and dad. Thank you for all you’ve taught me through the years! —Rocky Lhotka

  v Contents at a Glance About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix About the Technical Reviewers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv ■

  CHAPTER 12 Authentication and Authorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 ■

  CHAPTER 21 WCF Service Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651 ■

  CHAPTER 20 Web Forms UI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597 ■

  CHAPTER 19 Windows Presentation Foundation UI . . . . . . . . . . . . . . . . . . . . . . . . 563 ■

  CHAPTER 18 Example Data Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529 ■

  CHAPTER 17 Business Object Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499 ■

  CHAPTER 16 Other Framework Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469 ■

  CHAPTER 15 Persistence and the Data Portal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 ■

  CHAPTER 14 LINQ to CSLA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 ■

  CHAPTER 13 N-Level Undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 ■

  CHAPTER 11 Business and Validation Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 ■

  CHAPTER 1 Distributed Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 ■

  CHAPTER 10 Data Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 ■

  CHAPTER 9 Parent-Child Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 ■

  CHAPTER 8 Object Status Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 ■

  CHAPTER 7 Property Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 ■

  CHAPTER 6 Business Framework Implementation . . . . . . . . . . . . . . . . . . . . . . . . 197 ■

  CHAPTER 5 CSLA .NET Object Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 ■

  CHAPTER 4 CSLA .NET Object Stereotypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 ■

  CHAPTER 3 Object-Oriented Application Design . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 ■

  CHAPTER 2 Framework Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 ■

  INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 Contents About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix About the Technical Reviewers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv

  ■ Logical and Physical Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 N-Tier and SOA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

CHAPTER 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Distributed Architecture

  Complexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Relationship Between Logical and Physical Models . . . . . . . . . . . . . . 4 A 5-Layer Logical Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Applying the Logical Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 The Way Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Managing Business Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Potential Business Logic Locations . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Business Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Mobile Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Architectures and Frameworks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

  Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

  CHAPTER 2 Framework Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 ■

  Basic Design Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Validation and Business Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

  Tracking Whether the Object Has Changed . . . . . . . . . . . . . . . . . . . . 41 Integrated Authorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Strongly Typed Collections of Child Objects

  . . . . . . . . . . . . . . . . . . . 42 N-Level Undo Capability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Simple and Abstract Model for the UI Developer . . . . . . . . . . . . . . . 45 Supporting Data Binding

  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 Object Persistence and Object-Relational Mapping . . . . . . . . . . . . . 53 Custom Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 vii

  viii C O N T E N T S ■

  Designing the Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Business Object Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

  N-Level Undo Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Data Binding Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Business and Validation Rules

  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Data Portal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Custom Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Integrated Authorization

  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Helper Types and Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Namespace Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

  Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

  ■ Responsibility-Driven Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 Use-Case or Story-Based Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . 100

  Objects with Responsibilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 Objects Exist for Use Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Normalization of Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Application Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Use Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Object Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Initial Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Revising the Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Custom Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Using CSLA .NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

  Database Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 Creating the Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 PTracker Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 Security Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

  Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137

  C O N T E N T S ix

  CHAPTER 4 CSLA .NET Object Stereotypes . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 ■

  Basic Terminology and Object Graph Structure . . . . . . . . . . . . . . . . . . . 140 Business Object Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Object Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Object Retrieval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 Updating Editable Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Disposing and Finalizing Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 157

  Business Class Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 The Serializable or DataContract Attribute . . . . . . . . . . . . . . . . . . . . 159 Common Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Non-Public Default Constructor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

  Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

  ■ Business Class Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 Editable Root Business Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

CHAPTER 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 CSLA .NET Object Templates

  Editable Child Business Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 Switchable Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 Editable Root Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 Editable Child Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 Read-Only Business Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 Read-Only Child Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 Read-Only Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 Read-Only Child Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 Command Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 Name/Value List Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Dynamic Editable Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Dynamic Editable Root Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 Criteria Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195

  x C O N T E N T S ■

  ■ CSLA .NET Project Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 Project Directory Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198

  Project Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 Project Signing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 Supporting Localization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 Csla Namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 ApplicationContext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 BusinessBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 BusinessListBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 CommandBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 CriteriaBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 DataPortal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 EditableRootListBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 NameValueListBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 PropertyInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 ReadOnlyBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 ReadOnlyListBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 SingleCriteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 SmartDate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220

  Csla.Core Namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 BusinessBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 ExtendedBindingList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222

  IBusinessObject Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222

  ICommandObject Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

  IEditableBusinessObject Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

  IEditableCollection Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

  IReadOnlyObject Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224

  IReadOnlyCollection Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224

  ISavable Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224

  ISmartField Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225

  ISupportUndo Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225

  ITrackStatus Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

  IUndoableObject Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 ObjectCloner Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 ReadOnlyBindingList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229

  C O N T E N T S xi

  CHAPTER 7 Property Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 ■

  Declaring Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 Property Declaration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 RegisterProperty and Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 PropertyInfoManager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240

  Field Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 FieldManager Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 FieldDataManager Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250

  ■ Object Status Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251

CHAPTER 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 Object Status Management

  ITrackStatus Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 IsNew . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 IsSelfDirty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 IsDirty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 IsSelfValid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 IsValid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 IsSavable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 IsDeleted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258

  Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260

  CHAPTER 9 Parent-Child Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 ■

  Parent Editable Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 Parent-Child Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262

  IParent Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 Declaring Child Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 Parent Editable Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 Parent-Child Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274

  CHAPTER 10 Data Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 ■

  Windows Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 Object Data Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 Collection Data Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Controls and Helper Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 Working with Multiple Root Objects . . . . . . . . . . . . . . . . . . . . . . . . . 298

  xii C O N T E N T S ■

  WPF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 Object Data Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299

  Collection Data Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 Controls and Helper Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 Web Forms

  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 Controls and Helper Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317

  

CHAPTER 11 Business and Validation Rules . . . . . . . . . . . . . . . . . . . . . . . . . . 319

  Types of Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 Csla.Validation Namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 RuleHandler Delegate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 RuleArgs Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 DecoratedRuleArgs Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 RuleMethod Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 RuleDescription Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 ValidationRules Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 BrokenRule Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 BrokenRulesCollection Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 ValidationException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 Common Validation Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 CommonRules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338

  

CHAPTER 12 . . . . . . . . . . . . . . . . . . . . . . . 339

Authentication and Authorization

  Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 Csla.ApplicationContext.User Property . . . . . . . . . . . . . . . . . . . . . . . 340 Windows Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 Custom Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341

  Authorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 Type-Level Authorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 Property-Level and Method-Level Authorization . . . . . . . . . . . . . . . 349 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353

  C O N T E N T S xiii

  CHAPTER 13 N-Level Undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 ■

  Using Undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 Implementing Undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356

  ISupportUndo Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 NotUndoableAttribute Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 UndoableBase Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 BusinessBase Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 BusinessListBase Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382

  ■ Reducing Code with LINQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 Overview of LINQ to CSLA .NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384

CHAPTER 14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 LINQ to CSLA

  Binding to Results from LINQ to Objects . . . . . . . . . . . . . . . . . . . . . 384 Indexed LINQ Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 LINQ and Projection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 Identity Projections and LinqBindingList(Of T) . . . . . . . . . . . . . . . . . 385

  Understanding LinqBindingList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 Overview of Indexed Search Using CSLA .NET . . . . . . . . . . . . . . . . . . . . 387 Serialization and Indexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 Index Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387

  The IQueryable Implementation for CSLA .NET . . . . . . . . . . . . . . . . . . . . 389 Understanding Expression Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390 Digging into IQueryProvider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 LinqBindingList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393

  Indexed LINQ and CSLA .NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 Managing the Index Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 Expression Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 The Indexing Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395

  Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401

  xiv C O N T E N T S ■

  ■ Data Portal Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 Separation of Business Logic and Data Access . . . . . . . . . . . . . . . 404

  Consistent Coding Model for Root and Child Objects . . . . . . . . . . . 405 Channel Adapter and Message Router Patterns . . . . . . . . . . . . . . . 405 Distributed Transaction Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410 Context and Location Transparency . . . . . . . . . . . . . . . . . . . . . . . . . 412 Authorizing Server Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 Asynchronous Behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416 Object Factories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418 Base Class Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 Factory Methods and Criteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 Save Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 Updating Child Objects with the Field Manager . . . . . . . . . . . . . . . 426 Updating Editable Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427

  Reflection and Dynamic Method Invocation . . . . . . . . . . . . . . . . . . . . . . . 428 The MethodCaller Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429 The LateBoundObject Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430 Channel Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430 The RunLocal Attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431 The DataPortal Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431 The DataPortal(Of T) Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440 The IDataPortalServer Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442 The IDataPortalProxy Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443 The LocalProxy Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443 The WcfProxy Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444 The WcfPortal Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445

  Distributed Transaction Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446 The Transactional Attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 The Csla.Server.DataPortal Object . . . . . . . . . . . . . . . . . . . . . . . . . . 447 The ServicedDataPortal Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 The TransactionalDataPortal Class . . . . . . . . . . . . . . . . . . . . . . . . . . 452 Message Router . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453 The DataPortalSelector Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453 The SimpleDataPortal Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 The FactoryDataPortal Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460 The FactoryLoader Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460 The ChildDataPortal Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463

  C O N T E N T S xv

  Context and Location Transparency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464 The DataPortalContext Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464

  The DataPortalResult Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467 Csla.Server.DataPortalException . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467 Conclusion

  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468

  CHAPTER 16 Other Framework Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469 ■

  Date Handling with SmartDate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470 Initializing the Struct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 Supporting Empty Dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473 Conversion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473 Text Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474 Date Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475 Database Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476 Data Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476 Managing Database Connections and Contexts . . . . . . . . . . . . . . . 477 SafeDataReader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481 DataMapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485 Windows Workflow Foundation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 Starting a Workflow from an Object . . . . . . . . . . . . . . . . . . . . . . . . . 491 WorkflowManager Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492

  Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497

  ■ ProjectTracker Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499 Setting Up the Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500 Business Class Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501 Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502

CHAPTER 17 . . . . . . . . . . . . . . . . . . . . . . . . 499 Business Object Implementation

  ProjectResources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511 ProjectResource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514 Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515 RoleList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517 Resource and Related Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518 ProjectList and ResourceList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519 Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 Role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522 Implementing Exists Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524

  xvi C O N T E N T S ■

  Custom Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524 PTPrincipal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525

  PTIdentity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527

  ■ Data Access Layer Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529 Data Access Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530

  Balancing Design Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535 Data Access Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538 Using LINQ to SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 The ProjectTracker.DalLinq Project . . . . . . . . . . . . . . . . . . . . . . . . . 539

  Business Class Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542 Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542 ProjectResources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551 ProjectResource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552 RoleList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555 ProjectList and ResourceList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557 Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558 Implementing Exists Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 560

  Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562

CHAPTER 19

  . . . . . . . . . . . . . . . . . . . 563

Windows Presentation Foundation UI

  ■ Custom Authentication in WPF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564 Interface Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565

  User Control Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567 Value Converters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570 Application Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573 PTWpf Project Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576 The MainForm Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576 The Login Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 The RolesEdit Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581 The ResourceList Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 The ProjectList Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590 The ProjectEdit Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592

  Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596

  C O N T E N T S xvii

  CHAPTER 20 Web Forms UI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597 ■

  Web Development and Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597 State Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600 State on the Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600 Transferring State to or from the Client . . . . . . . . . . . . . . . . . . . . . . 603 State in a File or Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604 Interface Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605 Application Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 PTWeb Site Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611 Master Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612 Login Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616

  Business Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623 RolesEdit Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624 ProjectList Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634 ProjectEdit Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638

  Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 648

  ■ Choosing Between Client/Server and SOA . . . . . . . . . . . . . . . . . . . . . . . . 651 Overview of WCF Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653

CHAPTER 21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651 WCF Service Interface

  Elements of a WCF Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654 Custom Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662 Designing a WCF Service Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678 Service Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678

  Application Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679 PTWcfService Site Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681 Service Contract and Implementation . . . . . . . . . . . . . . . . . . . . . . . 682 Web Service Consumer Implementation . . . . . . . . . . . . . . . . . . . . . . . . . 687 Generating a WCF Information Page . . . . . . . . . . . . . . . . . . . . . . . . . 687 A Simple Smart Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689

  Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693

  INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 ■

  xix About the Authors

  ■ ROCKFORD LHOTKA is the author of numerous books. He is a Microsoft

  Regional Director, a Microsoft Most Valuable Professional (MVP), and an

  INETA speaker. He contributes to several major magazines and presents regularly at major conferences around the world. Rockford is the principal technology evangelist for Magenic ( www.magenic.com), one of the nation’s premiere Microsoft Gold Certified Partners that is focused on delivering business value through applied technology. For more information, go to www.lhotka.net.

JOE FALLON is the director of framework development at PurchasingNet, Inc., and is responsible for

  ■

  the development and implementation of the .NET Framework for PNet products. Prior to joining PurchasingNet, he worked at Nestle Chocolate and Confection as an assistant plant engineer after completing five years of service in the U.S. Army as a captain in the field artillery. During his tenure at Nestle, he held various positions in industrial engineering and IT. Joe graduated from the United States Military Academy at West Point, New York, and was the 1981 recipient of the General Omar Bradley Award as the Academy’s no. 1 mathematics major. He has been a Microsoft MVP for eight years in a row.

  About the Technical Reviewers JAMES MILLER is a senior architect and technical evangelist specializing in enterprise solutions. He

  ■

  has worked in multiple industries and capacities in both the public and private sectors, and he has more than 25 years of programming experience under his belt. He has embraced CSLA since 2002 and has been an active proponent of the framework in his career and on the CSLA forums. He is currently working with an ISV, leading an international group of developers to upgrade their prod- ucts to the latest .NET technologies, practices, tools, and techniques, while espousing the virtues of OOP, SOA, TDD, agile development, and CSLA. Jim is a proud graduate of the University of Michigan, is Microsoft certified in both VB .NET and C# for Windows and web-based applications, and jumped at the chance to contribute to the next version of the CSLA framework.

  Jim lives in a rural area outside Ann Arbor, Michigan, with his wife, five children, four cats, and three dogs. He fills much of his limited free time as the head coach of his local high school’s junior varsity boys’ lacrosse team. Jim still has an electric guitar plugged in over in a corner, a bookshelf filled with tech books, and a comfortable chair on the deck, perfect for viewing the deer as they meander by.

  ANDRÉS VILLANUEVA is a consultant/developer living in Argentina. After a start in IT at age 15, he ■

  moved to the software industry, coding with Visual FoxPro and Visual Basic 6. In 2004, Andrés moved on to .NET and hasn’t looked back. His early software experiences were in the banking industry, where he quickly rose as a leader, helping his firm improve consistency by implementing the CSLA framework. Since those days, he has made the leap into the consulting world and now provides soft- ware services from his office in Argentina to various clients around the world. He is an open source software fan and the current lead on the CslaGenerator project—an open source code-generation tool that targets development on the CSLA framework. In his little free time, Andrés enjoys playing soccer and relaxing with jazz music.

  xxi Acknowledgments

  his book is a major update to the previous edition. This book, and CSLA .NET 3.6, exist thanks to a

T lot of work from many people

  Although I wrote the original content in this book, Joe Fallon is responsible for converting the book from C# to VB. Joe was my first choice for this task, as he is an avid participant in the CSLA .NET community and online forum. Over the past few years, I have found him to be passionate, reliable, and detail-oriented. I think you’ll find these qualities show through in his work on this book.