10.5. Summary

The 2.0 Framework introduced a new design concept with provider-based features, which .NET 3.5 continues to support and make good use of. Rather than creating features and services where the internal implementations are "black boxes," the new provider-based features allow you to author custom implementations of business logic and data access logic. You can then swap these custom implementations into place with a few simple configuration settings.

The core design pattern used by provider-based features is the Strategy pattern. The Strategy pattern is a design approach that allows you to plug in different implementations for the core logic of a feature. In the case of both the 2.0 or 3.5 Frameworks and both ASP.NET 2.0 and ASP.NET 3.5, the providers are the implementation of the Strategy design pattern.

A number of support classes exist in System.Configuration, System.Configuration.Providers and System.Web.Configuration to make it easier to write provider-based features yourself. You can use the existing provider base class in conjunction with provider-specific configuration classes to build the basic underpinnings of a provider-based feature.

Overall the sample provider-based feature that was shown had roughly 200 lines for code (and that includes the braces!). Approximately half of the code is boilerplate implementation of things like the provider collection and the configuration class. However, with around only 100 lines of actual initialization code (and again ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.