10.2. Patterns Found in the Provider Model

If you have architected a fair number of applications, you invariably have come across design patterns, both theoretical ones that you considered when writing an application and the actual design patterns that you adopted in your application. The provider model in the .NET Framework is no different, with various pieces of the provider development stack mapping to well-known design patterns.

For the classic guide to design patterns, pick up a copy of "Design Patterns: Elements of Reusable Object-Oriented Software" by the Gang of Four: Eric Gamma, Richard Helm, Ralph Johnson, and John Vlissides. Addison-Wesley ISBN: 0-201-63361-2.

The provider-based features in both ASP.NET 2.0 and ASP.NET 3.5 are implementations of the following well-known design patterns:

  • Strategy

  • Factory Method

  • Singleton

  • Façade

Of the four common design patterns, the Strategy pattern is the core design concept that really makes the provider model so powerful.

10.2.1. The Strategy Pattern

In a nutshell, the Strategy design pattern is a design approach that encapsulates important pieces of a feature's functionality in a manner that allows the functionality to be swapped out with different implementations. A Strategy design approach allows a feature to define a public-facing definition of common functionality, while abstracting away the nitty-gritty of the implementation details that underlie the common functionality.

If you were to design your own feature using the Strategy ...

Get Professional ASP.NET 3.5 Security, Membership, and Role Management with C# and VB now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.