Table Of Content.NET Domain-Driven
Design with C#
Problem – Design – Solution
Tim McCarthy
Wiley Publishing, Inc.
ffffiirrss..iinndddd iiiiii 44//1144//0088 1100::3399::4488 AAMM
ffffiirrss..iinndddd iiii 44//1144//0088 1100::3399::4488 AAMM
.NET Domain-Driven
Design with C#
Acknowledgments ................................................................xv
Introduction ....................................................................... xvii
Chapter 1: Introducing the Project: The SmartCA Application ...1
Chapter 2: Designing the Layered Architecture ......................13
Chapter 3: Managing Projects ...............................................55
Chapter 4: Companies and Contacts ...................................109
Chapter 5: Submittal Transmittals .......................................157
Chapter 6: Requests for Information ....................................199
Chapter 7: Proposal Requests .............................................233
Chapter 8: Change Orders ...................................................265
Chapter 9: Construction Change Directives .........................295
Chapter 10: Synchronizing With the Server ..........................327
Chapter 11: The Client Membership System ........................357
Index .................................................................................391
ffffiirrss..iinndddd ii 44//1144//0088 1100::3399::4488 AAMM
ffffiirrss..iinndddd iiii 44//1144//0088 1100::3399::4488 AAMM
.NET Domain-Driven
Design with C#
Problem – Design – Solution
Tim McCarthy
Wiley Publishing, Inc.
ffffiirrss..iinndddd iiiiii 44//1144//0088 1100::3399::4488 AAMM
.NET Domain-Driven Design with C#
Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright © 2008 by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978–0–470–14756–6
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 Legal Department, Wiley Publishing,
Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, 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 specifically
disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No
warranty may be created or extended by sales or promotional 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 professional 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 Website 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 Website may provide or recommendations it may
make. Further, readers should be aware that Internet Websites 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 or to obtain technical support, please contact
our Customer Care Department within the U.S. at (800) 762-2974, outside the U.S. at (317) 572-3993 or
fax (317) 572-4002.
Library of Congress Cataloging-in-Publication Data is available from the publisher.
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 affiliates, in the
United States and other countries, 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.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not
be available in electronic books.
ffffiirrss..iinndddd iivv 44//1144//0088 1100::3399::4499 AAMM
About the Author
Tim McCarthy is a freelance consultant who architects, designs and builds highly scalable layered web
and smart client applications utilizing the latest Microsoft platforms and technologies. Tim is a Microsoft
MVP in Solutions Architecture, and his expertise covers a wide range of Microsoft technologies,
including, but not limited to, the following: .NET Framework (ASP.NET/Smart Clients/VSTO/
Workflow/Web Services, Windows Presentation Foundation), SQL Server, Active Directory, MS
Exchange development, UDDI, SharePoint, and Service Oriented Architecture (SOA) applications.
Tim has worked as both a project technical lead/member as well as being in a technical consulting role
for several Fortune 500 companies. He has held the Microsoft Certified Solution Developer (MCSD) and
Microsoft Certified Trainer (MCT) certifications for several years, and was one of the first wave of
developers to earn the Microsoft Certified Application Developer (MCAD) for .NET and MCSD for .NET
certifications. He also holds the Microsoft Certified Database Administrator certification for SQL Server
2000. Tim is also certified as an IEEE Certified Software Development Professional, and he is one of only
550 people to hold this certification in the world.
Tim has been an author and technical reviewer for several books from Wrox Press. His other books
include being a lead author on Professional VB 2005 , several editions of Professional VB.NET , Professional
Commerce Server 2000 , and Professional ADO 2.5 Programming . He also has written and presented a DVD
titled SharePoint Portal Services Programming 2003 . Tim has written numerous articles for the Developer
.NET Update newsletter, developed packaged presentations for the Microsoft Developer Network
(MSDN), and wrote a whitepaper for Microsoft on using COM+ services in .NET. He has also written
articles for SQL Server Magazine and Windows & .NET Magazine .
Tim has spoken at technical conferences around the world and several San Diego area user groups
(including both .NET and SQL Server groups, and several Code Camps), and he has been a regular
speaker at the Microsoft Developer Days conference in San Diego for the last several years. Tim has also
delivered various MSDN webcasts, many of which were repeat requests from Microsoft. He also teaches
custom .NET classes to companies in need of expert .NET mentoring and training.
Tim holds a B.B.A. in Marketing from the Illinois Institute of Technology as well as an M.B.A. in
Marketing from National University. Before becoming an application developer, Tim was an officer in
the United States Marine Corps. Tim ’ s passion for .NET is only surpassed by his passion for Notre Dame
Athletics.
Tim can be reached via email at tmccart1@san.rr.com .
ffffiirrss..iinndddd vv 44//1144//0088 1100::3399::4499 AAMM
ffffiirrss..iinndddd vvii 44//1144//0088 1100::3399::4499 AAMM
Credits
Acquisitions Editor Vice President and Executive Group Publisher
Katie Mohr Richard Swadley
Development Editor Vice President and Executive Publisher
Christopher J. Rivera Joseph B. Wikert
Technical Editor Project Coordinator, Cover
Doug Holland Lynsey Standford
Production Editor Proofreader
Rachel McConlogue Jen Larsen, Word One
Copy Editor Indexer
Foxxe Editorial Services Jack Lewis
Editorial Manager Cover Image
Mary Beth Wakefield Leandra Hosier
Production Manager
Tim Tate
ffffiirrss..iinndddd vviiii 44//1144//0088 1100::3399::4499 AAMM
Description:There are some things I don't like.1. UnitOfWork is broken. What happens when someone adds entity to repository, and then removes it before commiting? The code will try to remove not existing objects from database and then it will add it!2. Handling of child objects. For example addresses. In any re