Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

The Community Blog is a personal opinion of community members and by no means the official standpoint of DNN Corp or DNN Platform. This is a place to express personal thoughts about DNNPlatform, the community and its ecosystem. Do you have useful information that you would like to share with the DNN Community in a featured article or blog? If so, please contact .

The use of the Community Blog is covered by our Community Blog Guidelines - please read before commenting or posting.


Membership Services Provider Abstraction

To help explain some of the recent changes in the latest DotNetNuke Core release, I decided to blog about the Membership Services Provider abstraction. While this will not go into great detail for you to start creating your own set of providers, it should provide some guidance to help you understand what has changed and some history behind it to help understand why. To help make sure all levels of readers can follow along there are a few fundamental things to understand before moving on:

  • An abstract provider is, simply put, an API. This is a base set of methods which any inheriting concrete provider must override.
  • A concrete provider inherits from an abstract provider and overrides its methods.
  • Concrete providers interact with the data store and therefore are normally written data store specific (if the provider has any type of functionality that requires interacting with the data store).
  • All Providers are set in the Web.Config. Some specific providers have items, also set in the Web.Config, which determine the way the provider functions (Some more than others).

The original DotNetNuke 3 release used the ASP.NET backport MemberRole.dll, to prepare for the 2.0 ASP.NET framework. The way this was implemented into DotNetNuke adhered to the API of the MemberRole concrete providers and DotNetNuke based its membership API (the core's basis of its abstract provider) on it. MemberRole was actually all membership services including: membership, profile and roles. Since DotNetNuke has multi-portal capabilities, there were some things which MemberRole was not designed for and since DotNetNuke was working closely with Microsoft  they added the ApplicationName columns to make the provider usable in situations like DotNetNuke.

When the time came to start building against 2.0 framework classes instead of MemberRole.dll there were some changes which had to occur and even Microsoft warned of this possibility prior to distributing MemberRole.dll. To handle this prior to releasing the first 4.x core, the changes were minimal but did require work that did not break the API already in place of the core. These changes were made in both 4 and 3 lines of the core to keep the code bases in synch as much as possible.

When decisions were being made as to what focus on for the 3.3/4.3 release, a great deal of discussion and time was spent on figuring out the majority of use cases for DotNetNuke when it comes to Membership Services. In addition to this, the core team also realized its self imposed limitations in its first set of concrete providers (which were the same ones built for the original 3 release). One of the biggest limitations was that the way this was originally implemented, it was almost impossible for someone to write their own concrete provider to use with DotNetNuke without requiring core changes. The simplest way to summarize this is that the original API written in the core was not flexible enough to be a solid API and function as an abstract provider allowing people to create their own providers without modifying the core. (Thus not adhering to the provider model)

Although there were some changes to the previously existing functions, the now legacy ones will function for the time being which avoids breaking changes for module developers. If you are working in a module project which interacts with Membership, roles, profile methods; you should notice the items are marked as legacy and prior to releasing a new version of your module you should focus using the newly provided methods when you are able. Of course, once you rely on these new methods your module will only work with DotNetNuke versions 3.3/4.3 or greater. One last major item to mention that all these providers have in common is that the new abstraction has lowered the number of hits to the database.

Membership - AspNet Membership Provider

Concrete Provider Located @ - Providers\MembershipProviders\AspNetMembershipProvider\AspNetMembershipProvider.vb

This is the original 3.x implementation rewritten to adhere to the new API provided by the core. Since DotNetNuke has been distributed for over a year based on the aspnet implementation (MemberRole & 2.0 Framework classes) the first task was to tackle the API and create a new set of providers using the aspnet data store items. Because of how critical these items are to running a DotNetNuke site in addition to the number of users already operating sites based on this current setup this new AspNetMembershipProvider is simply what was available before but now the ability for developers to create their own custom concrete Membership provider is possible without core changes.  This concrete provider functions the same as the previous 3.x/4.x releases and does not support Single Sign On.

Previously and currently relies on these tables: aspnet_Membership, aspnet_Users as well as DNN's UserPortals, Users.

Roles - DNN Role Provider

Concrete Provider Located @ - Providers\MembershipProviders\DNNMembershipProvider\DNNRoleProvider.vb

As with Membership not too much has changed here either. The difference is that now the aspnet data store items are not used at all. Again, module developers should remove dependancy on legacy methods and adapt to using the latest API when developing newer module version or creating new modules. There is the basic addition of Role Groups in this instance as well (which the aspnet provider would not have supported out of the box), but currenly not much was developed to take advantage of this new addition (yet).

Previously used these tables: aspnet_Roles, aspnet_UsersInRoles. This also relied on Roles, UserRoles.

Currently uses these tables: Roles. UserRoles, RoleGroups.

Profile - DNN Profile Provider

Concrete Provider Located @ - Providers\MembershipProviders\DNNMembershipProvider\DNNProfileProvider.vb

Now this one is a huge change. If you have worked with the latest 3.3/4.3 you have probably seen the profile propery editor. This allows you to create registration items as well as profile items to customize your registration process. This provider tooks tons of effort and loads of testing. Not only was the provider itself built for this (in addition to the API changes), but everything around what was formerly Register.ascx and the two controls it used (Address.ascx & User.ascx I think was the other) had to change to work in the new registration which is dynamically loaded instead of being a single 'hard coded' ascx. One major benefit (besides dynamically built registration) is that the profile properties can be set per portal. This is a major change over the previous profile provider based on the aspnet implementation. (Remember, MemberRole was not originally built with the multi-portal environment in mind)

Those who worked with the previous AspNet implementation are probably aware of 'The Blob'!!! The blob is basically deliminted data stored between two columns: PropertyNames, PropertyValuesString. One column said what properties were collected, the other retained the values for the properties collected. (I believe both were seperated by the | character) Storing data in this manner allows it to be very extensible so you can easily add profile properties and values without changing the data schema but it presented a couple problems:

  • Ability to easily query data - since it was stored as ntext there were certain SQL restrictions that nvarchar column types do not have.  A sample query of 'SELECT * from table where Region = Georgia' was not possible unless you created UDF's or did this from code (a bit much to find out users who live in Georgia don't ya think?).
  • Not as efficient as possible. - The way ntext works it points to a seperate spot (page) in MS SQL, while nvarchar actually stores the value within the table. Its best to use nvarchar when possible, but developers have to be concerned of the row size limit unless they use ntext. (8060 bytes I believe)

The current implementation stores a new row of data for each profile property. If the data length going into the sproc is below a certain level (7500 I think), it is stored in the PropertyValue column as nvarchar, otherwise it is stored in the PropertyText ntext column. This allows one row of data per property and also increases efficiency.  One final addition here is that since the API is available to modules, module developers can start storing user specific data in this table using the API. This will allow certain things to be shared across modules. A good example would be if two modules wanted to know hair color but it wasn't collected at registration. If one module stores it in the UserProfile table and others first check there, the same data can be shared all from a central point across all modules. Of course, the first module should have checked to see if the property existed. The way this was designed, the same procedure first checks to see if it exists prior to creating it, if it does exist it will attempt to update it.

Now uses these tables: UserProfile (in combination with ProfilePropertyDefinition) ** Note: The Profile table has been available since DNN 2.1.2 I believe (at least 3.x). This is for storage of Personalization items of logged in users. Please do not confuse this table with the current or previous Profile provider. (It currently does not support Anonymous Personalization)

It should be noted that if you are a module developer you should try to make sure you are accessing items from any of these tables via the abstract provider API. This way, if a user has their own custom impmenentation of any of these, as long as their provider adheres to the API your module should work exactly the same if done correctly in both implementations.

Hope this offered some insight.

Comments

Comment Form

Only registered users may post comments.

NewsArchives


Aderson Oliveira (22)
Alec Whittington (11)
Alessandra Daniels (3)
Alex Shirley (10)
Andrew Hoefling (3)
Andrew Nurse (30)
Andy Tryba (1)
Anthony Glenwright (5)
Antonio Chagoury (28)
Ash Prasad (37)
Ben Schmidt (1)
Benjamin Hermann (25)
Benoit Sarton (9)
Beth Firebaugh (12)
Bill Walker (36)
Bob Kruger (5)
Bogdan Litescu (1)
Brian Dukes (2)
Brice Snow (1)
Bruce Chapman (20)
Bryan Andrews (1)
cathal connolly (55)
Charles Nurse (163)
Chris Hammond (213)
Chris Paterra (55)
Clint Patterson (108)
Cuong Dang (21)
Daniel Bartholomew (2)
Daniel Mettler (181)
Daniel Valadas (48)
Dave Buckner (2)
David Poindexter (12)
David Rodriguez (3)
Dennis Shiao (1)
Doug Howell (11)
Erik van Ballegoij (30)
Ernst Peter Tamminga (80)
Francisco Perez Andres (17)
Geoff Barlow (12)
George Alatrash (12)
Gifford Watkins (3)
Gilles Le Pigocher (3)
Ian Robinson (7)
Israel Martinez (17)
Jan Blomquist (2)
Jan Jonas (3)
Jaspreet Bhatia (1)
Jenni Merrifield (6)
Joe Brinkman (274)
John Mitchell (1)
Jon Henning (14)
Jonathan Sheely (4)
Jordan Coopersmith (1)
Joseph Craig (2)
Kan Ma (1)
Keivan Beigi (3)
Kelly Ford (4)
Ken Grierson (10)
Kevin Schreiner (6)
Leigh Pointer (31)
Lorraine Young (60)
Malik Khan (1)
Matt Rutledge (2)
Matthias Schlomann (16)
Mauricio Márquez (5)
Michael Doxsey (7)
Michael Tobisch (3)
Michael Washington (202)
Miguel Gatmaytan (3)
Mike Horton (19)
Mitchel Sellers (40)
Nathan Rover (3)
Navin V Nagiah (14)
Néstor Sánchez (31)
Nik Kalyani (14)
Oliver Hine (1)
Patricio F. Salinas (1)
Patrick Ryan (1)
Peter Donker (54)
Philip Beadle (135)
Philipp Becker (4)
Richard Dumas (22)
Robert J Collins (5)
Roger Selwyn (8)
Ruben Lopez (1)
Ryan Martinez (1)
Sacha Trauwaen (1)
Salar Golestanian (4)
Sanjay Mehrotra (9)
Scott McCulloch (1)
Scott Schlesier (11)
Scott Wilkinson (3)
Scott Willhite (97)
Sebastian Leupold (80)
Shaun Walker (237)
Shawn Mehaffie (17)
Stefan Cullmann (12)
Stefan Kamphuis (12)
Steve Fabian (31)
Steven Fisher (1)
Tony Henrich (3)
Torsten Weggen (3)
Tycho de Waard (4)
Vicenç Masanas (27)
Vincent Nguyen (3)
Vitaly Kozadayev (6)
Will Morgenweck (40)
Will Strohl (180)
William Severance (5)
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out