New book: Building Enterprise Applications with Windows Presentation Foundation and the Model View ViewModel Pattern

Book cover of Building Enterprise Applications with Windows® Presentation Foundation and the Model View ViewModel PatternWe’re excited to announce that Building Enterprise Applications with Windows Presentation Foundation and the Model View ViewModel Pattern (ISBN 9780735650923; 224 pages) by Raffaele Garofalo, is now available. Take advantage of Windows Presentation Foundation and the Model View ViewModel design pattern to build rich client applications for the enterprise. With this hands-on guide, you'll master the techniques to bind data to your WPF user interfaces by constructing an example application through the course of the book.

Here's information about the book, including a portion of its Introduction and the book's TOC:


The Windows Presentation Framework (WPF), Silverlight, and Windows Phone 7 are the latest technologies for building flexible user interface (UI) for applications built with Microsoft technology. All three rely on the XAML markup language to describe UI elements and layout, and you can program applications for all three platforms with the most common .NET Framework languages: Visual C# or VB.NET. If you are a NET developer planning to create a new Line-of-Business (LOB) application using the NET Framework, you should consider adopting one of these technologies as your UI technology. At the same time, as you start planning to build an application based on one of these technologies, you should also seriously consider learning an applying the Model View ViewModel (MVVM) presentation pattern, a design pattern created specifically for these technologies.




And that’s what this book is about. You might be wondering “Why another book on WPF?” or if you have already looked at the Table of Contents for this book, you could be thinking “Why another book about layering and design patterns?”


To answer those questions, let me start by saying that over the years I have noticed that what developers want is not the “Bible of patterns” or the “Bible of how to layer an application;” instead, they want a simple, straightforward book that guides them through the development criteria for a real-world, yet simple, application that uses and explains patterns—but that is also reusable in future projects as a “template” for other applications.


WPF and Silverlight are young technologies, and the percentage of developers moving to this new way of designing the UI is still small. There are several reasons for this situation. First, the learning curve is relatively high. If you’re used to Windows Forms, or Java Swing, or Delphi, the way you design and structure an application using XAML and WPF is significantly different—in fact, I would call it “revolutionary.”


In the past I have used well-known patterns to build applications, including the Model View Presenter pattern with Windows Forms applications, and the Model View Controller pattern with ASP.NET applications. But with WPF, these two approaches are now obsolete, because they can’t take advantage of the powerful engine provided by XAML. Of course, you can still take advantage of the binding engine of WPF using the Model View Presenter pattern, but the effort required is usually too large. Fortunately, MVVM provides an alternative.


Microsoft, in collaboration with some architects, has revised the original Presentation Model proposed years ago by Martin Fowler. This revision of the pattern has been named the “Model View ViewModel” (MVVM) pattern. MVVM is the perfect approach for WPF and Silverlight because…it was designed specifically for them! Unfortunately, like XAML, MVVM is a relatively new technology, so there isn’t a lot of information about implementing it at the moment. There are a few bloggers trying the MVVM approach and blogging about it; others are involved in building MVVM-specific toolkits. But nearly everything is still experimental, and there are few truly concrete examples.


So that’s the rationale for a book about building a LOB application using MVVM. During the course of this book you will see examples that show how to build straightforward Customer Relationship Management (CRM) program with WPF 4, Silverlight 4, and the MVVM pattern. The book guides you through the entire architectural process, illustrating the correct approach to using MVVM. You’ll also use some other new technologies delivered with Microsoft NET 4, such as Managed Extensions, Windows Workflow Foundation 4, and of course, the Entity Framework.


First, you’ll get introduced to the tools. Then you can move ahead to build the CRM, starting with the domain model, applying a simple technique to persist the data in a relational database using two of the most popular object-relational management (OR/M) systems available for .NET: the Entity Framework and NHibernate. Then you’ll see how to make everything more flexible using the MEF framework.


The next step will be to apply business logic and data validation to this model, in a way that fulfills the requirements of the MVVM pattern. In this phase, you’ll also look at the new powerful workflow engine by Microsoft, Windows Workflow Foundation (WF) 4.0 and the steps required to build a simple workflow engine.


The remaining chapters all focus on MVVM. There are four major concepts that you must learn to use MVVM correctly: commanding, the template, the binding engine, and how to orchestrate everything together. At the end of this process you will have visited all the layers required to complete a classic LOB application, but more importantly, you will be able to recycle the parts described here as a template for building future applications. Of course there are some differences between WPF and Silverlight, so this book will try to cover those gaps where possible.


Finally, you’ll take a brief tour of the MVVM toolkits that are already available, such as PRISM, a composite application framework for WPF and Silverlight. You’ll see when you should use each as part of the process of building a small and flexible MVVM framework.


Overall, the key goal of this book is to provide a complete step by step guide for using WPF/Silverlight in conjunction with MVVM, creating generic code that you will be able to use and re-use in the future.


Building Enterprise Applications with Windows Presentation Foundation and the Model View ViewModel Pattern provides not only a solid analysis of how the MVVM pattern works and how to apply it with WPF and Silverlight, but it also provides an exhaustive guide to building layered applications using the most common and accepted techniques. This book intentionally doesn’t show all the related code for any given project; instead, it focuses more on the principles and patterns that developers should apply to create well-structured and easy to maintain LOB applications.


The book analyzes each layer that composes a LOB application, starting with the Domain Model (also known as the Business Layer), moving to the Data Layer, including an overview of the two most-used Object Relational Mapper (OR/M) frameworks for .NET, Entity Framework and NHibernate, and ends with a chapter dedicated to Business Rules and Windows Workflow Foundation. Of course you will also find a chapter dedicated to the MVVM pattern.


In addition to the patterns and practices explained in the book, Chapter 7 contains a useful list of open source frameworks and plug-ins used by others in the .NET community to build applications that implement the MVVM pattern with WPF or Silverlight.


Table of Contents

  1. Chapter 1 Introduction to Model View ViewModel and Line of Business Applications
    1. The Model View ViewModel Pattern
    2. Line of Business Applications
    3. Choosing the Right Technology
    4. Composition of a LOB User Interface
    5. Separation of Concerns
    6. Summary
  2. Chapter 2 Design Patterns
    1. An Overview of Design Patterns
    2. UI Design Patterns
    3. Advanced Design Patterns and Techniques
    4. Summary
  3. Chapter 3 The Domain Model
    1. Introduction to Domain-Driven Design
    2. Domain Entity and Data Transfer Object
    3. The POCO Object and the O/RM
    4. Development Approaches of a Domain
    5. How To Create an Object In DDD
    6. Domain Entities Validation
    7. Unit Test the Domain Model
    8. Sample Code: The CRM Domain Model
    9. Summary
  4. Chapter 4 The Data Access Layer
    1. Introduction
    2. The Database and Stored Procedures
    3. Choosing an O/RM
    4. The Unit of Work
    5. The Repository Pattern
    6. Test-Driven Development: The Data Layer
    7. Building a Distributed Data Layer with RIA and WCF
    8. Sample Code: The CRM Data Access Layer
    9. Mapping the Domain Using NHibernate
    10. Summary
  5. Chapter 5 The Business Layer
    1. Introduction
    2. A Business Rule Is Not a Validation Rule
    3. Business Rules by Service
    4. Business Rules by Workflow with WF 4.0
    5. Third-Party Toolkits
    6. Business Layer Considerations
    7. Sample Code: The Business Service Layer
    8. Summary
  6. Chapter 6 The UI Layer with MVVM
    1. Introduction to the MVVM Pattern
    2. The View
    3. The Model
    4. The Command in WPF and Silverlight
    5. The ViewModel
    6. DataTemplate in WPF and Silverlight
    7. WeakEvents and Messages
    8. Dialogs and Modal Pop-Ups
    9. Inversion of Control with MVVM
    10. Sample Code
    11. Summary
  7. Chapter 7 MVVM Frameworks and Toolkits
    1. MVVM Toolkits
    2. MVVM and XAML Facilities
    3. Composite UI Frameworks
Skip to main content