ASP.NET 2.0 Provider Model

ASP.NET 2.0 introduces a new Provider model which allows developers to implement a requirement differently without changing a common interface. There three aspects to it - the provider class, the configuration layer and a data store. The Provider class implements the functionality, the configuration layer lets you configure which provider to use irrespective of the data store. The data store could be Active Directory, SQL Server, Oracle, etc. Let me explain with an example.

Consider authenticating users using a Membership provider. If you want to use “as is”, you need to set up a SQL Server database, make few configuration entries in Web.config and have a login control in your ASP.NET page. No explicit coding is required to authenticate users. On other hand, if you want to have your custom authentication method, you can create your own Membership Provider by extending the MembershipProvider class and overriding the ValidateUser method and other “must override” members. While doing so, you do not have to change the code tightly coupled with the UI (the code that invokes the provider).

To learn more, read this MSDN article.

No comments:


Powered by Blogger.