Provider Model Design Pattern

Intro

Well I got my self a blog place. This is my "Hello World" blog. Why am I blogging? Here I'll give a try to contribute to the community with my posts and I hope they are going to be interesting and useful. I'll try to cover areas of common interest, every day working problems and solutions. Here I will expose my opinion about development trends and technologies, about my work issues, best practices etc. I'll share my knowledge with the community and I want to learn from the community by sharing their knowledge and opinion. I expect negative feedback from comments on my blog posts (Negative feedback is term that is used in the Automatic Driven Processes, and I had this class when I was at the facultyGeeked). With this, I mean that when negative feedback is received that leads you to improve yourself to fill your knowledge gaps and to get learn positive characteristics.

Negative feedback explanation (for reminding)

“When a fraction of the output of an amplifier is combined with the input, feedback exists; if the feedback opposes the original signal, it is negative feedback and if it increases the signal it is positive feedback. A negative feedback amplifier, or more commonly simply a feedback amplifier, is an amplifier which uses negative feedback to improve performance (gain stability, linearity, frequency response, step response) and reduce sensitivity to parameter variations due to manufacturing or environmental uncertainties.”

A single feedback loop with unilateral blocks

    Translation:
    Input = Blog Post
    Output = Community contribution
    Beta = feedback as blog comments

 

 

 

In my first blog I’ll try to share my interest in some of the design patterns that were presented in one of the mkdot.net sessions.

Provider model design pattern

Maybe I’m little late with this post but I want to emphasize the use of the provider model introduced in the ASP.NET 2.0 and its implementations within Membership, Roles, Sitemap and other providers. The starting point for teaching yourself about Provider Toolkit is here and also additional information about building your provider model.
In this post I’ll show my homework implementing small Membership provider following the steps described here and here.

 
A provider is a software module that provides a uniform interface between a service and a data source. Providers abstract physical storage media, in much the same way that device drivers abstract physical hardware devices. Because virtually all ASP.NET 2.0 state-management services are provider-based, storing session state or membership state in an Oracle database rather than a Microsoft SQL Server database is as simple as plugging in Oracle session state and membership providers. Code outside the provider layer needn't be modified, and a simple configuration change, accomplished declaratively through Web.config, connects the relevant services to the Oracle providers.

My Homework

First of all setting the web.config sections as described in the picture bellow is needed. We define section group name (green rectangle), then define section name (blue rectangle) and type. Then these section definitions need to be included in the <system.web> section.

In the next figure is presented the class diagram of the MyProvider class library. As you can see there are several classes with certain behavior

Class explanation:

  1. ProviderBase.cs –  is the base class common to all providers.
  2. MembershipProvider.cs – is base class (contract), which is used to implement the desired behaviors for the Membership API.
  3. SqlMembershipProvider.cs – is our implementation of the Membership APIs for a Microsoft SQL Server database. Also we can implement it for Oracle or MySQL database systems or it can be implemented with XML or flat files. All of our Data Access Layer (DAL) and Business Logic Layer (BLL) code is put into this class.
  4. Membership.cs – is class that defines routines for our API such as CreateUser, Validate, GetAllUsers, IsActive etc. When calling routines on this class internally it will always forward those calls to an instance of the MembershipProvider.
  5. Provider.cs - is the basic definition of the feature’s provider class. This class contains information about entries in the <providers> section for MembershipVane's configuration section.
  6. MembershipConfigurationHandler.cs - reads the XML configuration information from the web.config file.

Sources:

http://msdn.microsoft.com/en-us/library/ms972319.aspx
http://msdn.microsoft.com/en-us/library/ms972370.aspx
http://msdn.microsoft.com/en-us/library/aa479030.aspx?ppud=4
http://www.agdstudio.com/DesignPatterns/ProviderModel/ASPNET2.0ProviderModel.pdf

Download:

ProviderPatternExample.rar
ProviderPatternExample_2.rar

Published Sun, Oct 19 2008 19:53 by vanespasov

Comments

# re: Provider Model Design Pattern

Saturday, October 25, 2008 4:45 AM by Dame1612

Негативна  повратна   врска ... Ме  подсети  на  мерење  и  автоматска  регулација .... Иначе  во  овој  тип  на   регулација  ти  фали  компензатор . тоа  е  справа  што  регулира  во  кој  степен  ке  биде  засилен  или  намален  повратниот   сигнал ... Иначе  без  константа  на  компензација  при  влез  на  голем  сигнал излезниот   сигнал   може  да  не  компензира  доволно ...  за  подетални  информации  за  конструкција на  негативна  повратна  врска  консултирај  root  locus

www.roymech.co.uk/.../root_locus.html

Kibernetika  има  многу  широка  примена ...  Браво  за  постот  овоа   го  поштујем .....

ПС  На  сликата  на  линкот  компензаторот  е  со  буква К ... Во  пракса  без  него  или  бар  без  константа  неиде ....

# My Favourite Website

Saturday, September 26, 2009 4:07 PM by Kelli Garner

Really nice posts.  I will be checking back here regularly.

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Powered by Community Server (Commercial Edition), by Telligent Systems