Wrox Press Professional ASP.NET Design Patterns (2010).pdf

(6698 KB) Pobierz
Professional
asP.neT Design Patterns
Scott Millett
1015552883.016.png 1015552883.017.png 1015552883.018.png 1015552883.019.png 1015552883.001.png 1015552883.002.png 1015552883.003.png 1015552883.004.png 1015552883.005.png 1015552883.006.png 1015552883.007.png 1015552883.008.png 1015552883.009.png 1015552883.010.png 1015552883.011.png 1015552883.012.png
Professional ASP.NET Design Patterns
Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright © 2010 by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-0-470-29278-5
ISBN: 978-0-470-94445-5
ISBN: 978-0-470-95289-4
ISBN: 978-0-470-95301-3
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108
of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization
through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers,
MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the
Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201)
748-6008, or online at http://www.wiley.com/go/permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with
respect to the accuracy or completeness of the contents of this work and speciically disclaim all warranties, including with-
out limitation warranties of itness for a particular purpose. No warranty may be created or extended by sales or promo-
tional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with
the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If profes-
sional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor
the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work
as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the
information the organization or Web site may provide or recommendations it may make. Further, readers should be aware
that Internet Web sites listed in this work may have changed or disappeared between when this work was written and when
it is read.
For general information on our other products and services please contact our Customer Care Department within the
United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available
in electronic books.
Library of Congress Control Number: 2010929314
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress are
trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its afiliates, in the United States and other coun-
tries, and may not be used without written permission. All other trademarks are the property of their respective owners.
Wiley Publishing, Inc. is not associated with any product or vendor mentioned in this book.
ParT
i
inTroDucing PaTTerns anD PrinciPles
The Pattern for Successful Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
chaPTer 1
Dissecting the Pattern’s Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
chaPTer 2
ParT i
i
The anaTomy of an asP.neT aPPlicaTion:
learning anD aPPlying PaTTerns
Layering Your Application and Separating Your Concerns . . . . . . . . . . 3 1
chaPTer 3
The Business Logic Layer: Organization . . . . . . . . . . . . . . . . . . . . . . . . . . 55
chaPTer 4
The Business Logic Layer: Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
chaPTer 5
The Service Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
chaPTer 6
The Data Access Layer ........................................195
chaPTer 7
The Presentation Layer ........................................289
chaPTer 8
The User Experience Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
chaPTer 9
ParT ii
i
case sTuDy: The online e-commerce sTore
Requirements and Infrastructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
chaPTer 1 0
Creating The Product Catalog ..................................449
chaPTer 11
Implementing the Shopping Basket .............................519
chaPTer 12
Customer Membership ........................................565
chaPTer 13
Ordering and Payment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615
chaPTer 14
inDex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673
abouT The auThor
scoTT milleTT is an enterprise software architect working in London for Wiggle.co.uk, an e-commerce
company specializing in cycle and triathlete sports. He has been working with .NET since version 1.0
and was awarded the ASP.NET MVP in 2010. He is the co-author of Wrox’s Professional Enterprise
.NET , and when not writing about or working with .NET he can be found relaxing and enjoying the
music at Glastonbury and all of the major music festivals in the UK during the summer. If you would
like to talk to Scott about the book, anything .NET, or the British music festival scene, feel free to write
to him at scott@elbandit.co.uk , or by giving him a tweet @ScottMillett .
conTenT
ParT i:
inTroDucing PaTTerns anD PrinciPle
s
chaPTer 1:
The PaTTern for successful aPPlicaTions
3
Design Patterns explained
4
Origins
4
Necessity
4
Usefulness
5
What They Are Not
5
Design Principles
6
Common Design Principles
6
The S.O.L.I.D. Design Principles
7
fowler’s enterprise Design Patterns
8
Layering
8
Domain Logic Patterns
8
Object Relational Mapping
9
Web Presentation Patterns
1 0
Base, Behavioral, and Structural Patterns
1 0
other Design Practices of note
11
Test-driven Development (TDD)
11
Domain-driven Design (DDD)
11
Behavior-driven Design (BDD)
12
summary
12
chaPTer 2:
DissecTing The PaTTern’s PaTTern
13
How to read Design Patterns
13
Gang of Four Pattern Template
14
Simpliied Template
14
Design Pattern Groups
15
Creational
15
Structural
15
Behavioral
1 6
How to Choose and apply a Design Pattern
17
1015552883.013.png 1015552883.014.png 1015552883.015.png
 
Zgłoś jeśli naruszono regulamin