简体   繁体   中英

Anyone can explain the provider model in asp.net 2.0

最好举一个简单的例子。

The spec can be found at: http://msdn.microsoft.com/en-us/library/ms972319.aspx

From http://en.wikipedia.org/wiki/Provider_model

The .NET extensible provider model allows a "component" to have multiple implementations using an abstract factory pattern approach. Providers are a subclass of the ProviderBase class and typically instantiated using a factory method.

An example would be membership providers. At runtime it works out which provider to use based on configuration settings. The provider must adhere to a specification (defined usually by an interface). It creates an instance of the type specified that can fulfill the requirements of the specification, and then calls methods on it to do the work.

This lets you augment and enhance default functionality to provide your own implementation (ie: custom authentication logic) using a standard interface.

Very similar to abstract factory and builder patterns.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM