Click here to Skip to main content
15,879,326 members
Articles / Database Development / SQL Server

Provider Design Patterns in NET 2.0

Rate me:
Please Sign up or sign in to vote.
4.96/5 (14 votes)
29 Oct 2008CPOL7 min read 72.4K   1K   86  
Provider Design Pattern is a new pattern that Microsoft formalized in .NET 2 to increase application performance where there is no need to explicitly instantiate classes.
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Configuration;
using System.Configuration;
using CompanyName.PhoneBook.DataAccessLayer;

namespace CompanyName.PhoneBook.DataAccessLayer
{
    public abstract class InitMember<T>
    {
        public static ProviderList Providers(string _providerSectionName)
        {
            SectionConfig qc = (SectionConfig)ConfigurationManager.GetSection(_providerSectionName);
            providerCollection = new ProviderList();
            // this wl instatiate PersonProvider with the class "personimpl" which inherit it
            ProvidersHelper.InstantiateProviders(qc.Providers, providerCollection, typeof(T));
            providerCollection.SetReadOnly();
            return providerCollection;
        }

        private static ProviderList providerCollection;
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Egypt Egypt
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions