Table of Contents
Introduction
Conventions and Features in This Book
Acknowledgments
Errata and Book Support
Chapter 1. Introduction to Model View ViewModel and Line of Business Applications
The Model View ViewModel Pattern
Line of Business Applications
Choosing the Right Technology
Silverlight or WPF?
Microsoft’s UI-Building Tools
Composition of a LOB User Interface
The Menubar
The Toolbar
The Tooltip (and Its Abuse)
Notifications and Alerts
The Ribbon Bar
General Style and Control Considerations
Separation of Concerns
Layers, Tiers, and Services
Summary
Chapter 2. Design Patterns
An Overview of Design Patterns
Classifying Design Patterns
UI Design Patterns
The MVC Pattern
The MVP Pattern
The PM Pattern and MVVM
Advanced Design Patterns and Techniques
The Inversion of Control Pattern
DSLs: Writing Fluent Code
Introduction to TDD
Summary
Chapter 3. The Domain Model
Introduction to Domain-Driven Design
DDD Terminology
Analyzing the CRM Domain
Domain Entity and Data Transfer Object
The POCO Object and the O/RM
Development Approaches of a Domain
Transaction Script
Database-Driven Approach
Domain-Driven Approach
How To Create an Object In DDD
Factory Patterns
Domain Entities Validation
Classic Validation
Validation Using Attributes and Data Annotations
Available Validation Frameworks
Unit Test the Domain Model
Sample Code: The CRM Domain Model
The Person Context
The Order Domain
Summary
Chapter 4. The Data Access Layer
Introduction
The Database and Stored Procedures
Choosing an O/RM
Microsoft Entity Framework
NHibernate
Other O/RMs for .NET
The Unit of Work
Lifecycle of a UoW
Identify a Business Transaction
The Repository Pattern
Test-Driven Development: The Data Layer
Building a Distributed Data Layer with RIA and WCF
Sample Code: The CRM Data Access Layer
A Flexible IUnitOfWork Interface
Mapping the Domain Model Using Entity Framework
Mapping the Domain Using NHibernate
Getting the Tools
The UnitOfWork and the ISession
Summary
Chapter 5. The Business Layer
Introduction
A Business Rule Is Not a Validation Rule
Business Rules by Service
The Facade Pattern
Business Rules by Workflow with WF 4.0
Different Ways of Running a Workflow
Third-Party Toolkits
Technologies for the Data Validation
Rule Engine and Business Rule Engine
Business Layer Considerations
When Do I Need to Create a Business Layer?
Bad BLL Habits
Sample Code: The Business Service Layer
Data Validation with the Enterprise Library 5.0
A Generic Workflow Engine
Service for Business Transactions
Summary
Chapter 6. The UI Layer with MVVM
Introduction to the MVVM Pattern
The View
Blendability: A Dummy ViewModel
The Model
The Command in WPF and Silverlight
A Workaround: An MVVM Command
Re-evaluate ICommand Execution
The ViewModel
The INotifyPropertyChanged Interface
The IDataErrorInfo Interface
DataTemplate in WPF and Silverlight
DataTemplate and MVVM
WeakEvents and Messages
The WeakEvent Pattern
The EventAggregator Pattern
Dialogs and Modal Pop-Ups
Modal View in MVVM
Inversion of Control with MVVM
Sample Code
The Microsoft Office Ribbon and MVVM
Summary
Chapter 7. MVVM Frameworks and Toolkits
MVVM Toolkits
MVVM Light Toolkit, by Laurent Bugnion
MEFedMVVM
Cinch, by Sacha Barber
MVVM and XAML Facilities
Karl Shifflett’s Tools
Radical, by Mauro Servienti
Composite UI Frameworks
Microsoft Prism
Caliburn
Index
About the Author