Friday, 15 January 2010

asp.net - Relationship Between ASPNET Membership Provider Tables and Custom Membership Tables -


I went through a custom profile provider example some time ago and now I am reviewing it.

All dbo.aspnet_ * tables are created in my database when I started the aspnet registration wizard. In these tables, I have an ASPNet profile in which there is an FK obligation, pointing to ASPnet_USers.

I also have two tables MyDB: First of all, DBAPROFILEDATA, is a foreign key constraint that points towards dbo.Profile.

What do I understand is that tables in MyDB are related to those in dbo.aspnet_ * MyDB and aspnet tables should not have a foreign key constraint (or any kind of relationship) between profile tables. ? Some discussion about my custom tables with the people provided by the escenu would be amazing

thanks in advance

I can see there are two options, both of which will basically give the same result:

  • dbo.aspnet_User.UserID < > From dbo.Profile.UserID , then define a unique key on dbo.Profile .UserID (as long as you make it to dbo.Profile Do not use PK columns as If)

  • The dbo.aspnet_Profile FK. ProfileID to dbo.Profile.ProfileID

dbo.aspnet_user logically 1 - 1 of With dbo.aspnet_Profile , it does not really matter which approach you use, as you'll still get the same relational integrity

if you With the implementation of the self, instead of replacing the standard profile data table, it makes more sense to use the first suggestion, otherwise if you have So Hail are extended schema using other suggestions.

edit

aspnet_Profile is the standard table - standard SqlProfileProvider stored user's profile data As a serialized property bag in aspnet_Profile , why not even have a separate aspnet_ProfileData table

from this perspective to the profile schema Can be easily adapted for different applications without any changes to the underlying database required So there is, and that .NET is the most suitable solution for a structure. The flaw is that SQL Server does not have easy access to this data, so it is more difficult to index, update and link the user's profile data using T-SQL and set-based logic.

The most common approach I've seen to remove this limitation is to expand the standard SqlProfileProvider to write in a custom profile data table, which includes application-specific profiles There are specific columns for properties. This table naturally has 1-1 relationships with the aspnet_Profile table, so above it is a foreign key as the above signal.

The role of the extended provider is to promote specific profile properties for columns during the profile profile, and read in the columns when the profile is retrieved.

This allows you to blend and match storage solutions on a need-based basis, as long as your extended provider knows how to come back to the standard implementation, where it is given about 'address 'Is not property

I always think it is best to leave standard membership tables, and where it is necessary to use new tables with the appropriate foreign key, then give the sub-category to the appropriate provider and the provider's methods Override with yourself Implementation (wherever possible, calling in the base implementation).


No comments:

Post a Comment