expert vb 2008 business objects

714 453 0
expert  vb  2008  business  objects

Đ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

www.it-ebooks.info Expert VB 2008 Business Objects ■■■ Rockford Lhotka with Joe Fallon www.it-ebooks.info 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 orders-ny@springer-sbm.com, or 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 info@apress.com, 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. www.it-ebooks.info To my mom and dad. Thank you for all you’ve taught me through the years! —Rocky Lhotka www.it-ebooks.info v Contents at a Glance About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix About the Technical Reviewers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv ■CHAPTER 1 Distributed Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 ■CHAPTER 2 Framework Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 ■CHAPTER 3 Object-Oriented Application Design . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 ■CHAPTER 4 CSLA .NET Object Stereotypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 ■CHAPTER 5 CSLA .NET Object Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 ■CHAPTER 6 Business Framework Implementation . . . . . . . . . . . . . . . . . . . . . . . . 197 ■CHAPTER 7 Property Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 ■CHAPTER 8 Object Status Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 ■CHAPTER 9 Parent-Child Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 ■CHAPTER 10 Data Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 ■CHAPTER 11 Business and Validation Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 ■CHAPTER 12 Authentication and Authorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 ■CHAPTER 13 N-Level Undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 ■CHAPTER 14 LINQ to CSLA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 ■CHAPTER 15 Persistence and the Data Portal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 ■CHAPTER 16 Other Framework Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469 ■CHAPTER 17 Business Object Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499 ■CHAPTER 18 Example Data Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529 ■CHAPTER 19 Windows Presentation Foundation UI . . . . . . . . . . . . . . . . . . . . . . . . 563 ■CHAPTER 20 Web Forms UI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597 ■CHAPTER 21 WCF Service Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651 ■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 www.it-ebooks.info vii Contents About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix About the Technical Reviewers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv ■CHAPTER 1 Distributed Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Logical and Physical Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 N-Tier and SOA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 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 www.it-ebooks.info viii ■CONTENTS 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 ■CHAPTER 3 Object-Oriented Application Design . . . . . . . . . . . . . . . . . . . . . . 99 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 www.it-ebooks.info ■CONTENTS 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 ■CHAPTER 5 CSLA .NET Object Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 Business Class Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 Editable Root Business Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 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 www.it-ebooks.info x ■CONTENTS ■CHAPTER 6 Business Framework Implementation . . . . . . . . . . . . . . . . . . 197 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 www.it-ebooks.info ■CONTENTS 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 ■CHAPTER 8 Object Status Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 Object Status Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 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 www.it-ebooks.info [...]... loaded assemblies, application configuration files, and more Chapters 17 and 18 create the business objects for the application These chapters illustrate how you can use the framework to create a powerful set of business objects rapidly and easily for an application The end result is a set of objects that not only model business responsibilities, but also support data binding, validation, authorization,... Chapter 19 demonstrates how to create a WPF interface to the business objects Chapter 20 covers the creation of an ASP.NET Web Forms interface with comparable functionality Chapter 21 shows how to build WCF services using business objects This approach enables service-oriented development by providing a programmatic interface to the business objects that any web service or WCF client can call By the... developer using it can focus almost entirely on business logic and application design rather than on getting caught up in “plumbing” issues This book is a major update to the previous edition, Expert VB 2005 Business Objects This updated book takes advantage of new features of NET 3.5 and applies lessons learned by using NET 2.0 and 3.0 over the past few years This book is the most recent expression of... applications that power major parts of their businesses This framework addresses two primary areas of object-oriented software development: • How to use business objects to efficiently build Windows, web, and service-oriented applications • How to enable the use of object-oriented design in a distributed computing environment While NET supports the use of objects, the author of an object has to do a... won’t spend much time dealing with interface development or frameworks in this book Instead, I’ll focus on simplifying the creation of the business logic and data access layers, which are required for any type of interface Business Logic Business logic includes all business rules, data validation, manipulation, processing, and authorization for the application One definition from Microsoft, which has... user experience, the Business layer must implement all the business logic, because it is the only point of central control and maintainability I believe that this particular separation between the responsibilities of the Business layer and Interface Control layer is absolutely critical if you want to gain the benefits of increased maintainability and reusability This is because any business logic that... challenges, and CSLA NET uses various techniques to overcome those challenges For n-tier client/server applications, the framework supports the idea of mobile objects objects that actually move between computers in an n-tier environment Mobile objects provide a powerful way to implement object-oriented designs in distributed environments For service-oriented applications, CSLA NET can be used to build... architecture without jumping through hoops • To enable high scalability • To enable high performance • To enable developer productivity when using business objects, including: • Support for data binding in Windows and Web Forms • Support for many types of UIs based on the same objects • Management of validation rules • Management of authorization rules • N-level undo on a per-object basis (edit, cancel, apply)... write a lot of extra code to track business rules, implement n-level undo, and support serialization of object data All this code is important, but it adds nothing to the business value of the application Fortunately, NET offers some powerful technologies that help to reduce or eliminate much of this “plumbing” code If those technologies are then wrapped in a framework, a business developer shouldn’t have... This Book The code in this book has been verified to work against Microsoft Visual Studio 2008 Professional Edition SP1 and against version 3.5 SP1 of the NET Framework The database is a SQL Server Express database, which is included with Visual Studio 2008 Professional The Enterprise version of Visual Studio 2008 and the full version of SQL Server are useful but not necessary To run the tools and . www.it-ebooks.info Expert VB 2008 Business Objects ■■■ Rockford Lhotka with Joe Fallon www.it-ebooks.info Expert VB 2008 Business Objects Copyright © 2009 by Rockford Lhotka All. entirely on business logic and application design rather than on getting caught up in “plumbing” issues. This book is a major update to the previous edition, Expert VB 2005 Business Objects. This. 148 Updating Editable Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Disposing and Finalizing Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Business Class

Ngày đăng: 05/05/2014, 13:41

Từ khóa liên quan

Mục lục

  • 1430216387

  • Expert VB 2008 Business Objects

  • Dedication

  • Contents at a Glance

  • Contents

  • About the Authors

  • About theTechnical Reviewers

  • Acknowledgments

  • Introduction

  • C H A P T E R 1 Distributed Architecture

  • C H A P T E R 2 Framework Design

  • C H A P T E R 3 Object-Oriented Application Design

  • C H A P T E R 4 CSLA .NET Object Stereotypes

  • C H A P T E R 5 CSLA .NET Object Templates

  • C H A P T E R 6 Business Framework Implementation

  • C H A P T E R 7 Property Declarations

  • C H A P T E R 8 Object Status Management

  • C H A P T E R 9 Parent-Child Relationships

  • C H A P T E R 1 0 Data Binding

  • C H A P T E R 1 1 Business and Validation Rules

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

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

Tài liệu liên quan