poniedziałek, 12 grudnia 2011

ASP.NET SQL Provider Part 2 - Tables and store procedures

ASPNETDB Database 

The structure of the SQL provider database:


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tables
Name  Description 
aspnet_Applications  Used by ASP.NET features to provide an application scope for data.
aspnet_Membership  Used by the SQL Membership Provider to store membership data.
aspnet_Paths  Used by the SQL Personalization Provider to store the path for which Web Parts personalization state has been saved.
aspnet_PersonalizationAllUsers  Used by the SQL Personalization Provider to store shared personalization data.
aspnet_PersonalizationPerUser  Used by the SQL Personalization Provider to store per-user personalization data.
aspnet_Profile  Used by the SQL Profile Provider to store individual instances of property values.
aspnet_Roles  Used by the SQL Role Provider to store role data.
aspnet_SchemaVersions  Used to track the versions of schemas required by ASP.NET features.
aspnet_Users  Used to store information regarding users, including user names and IDs.
aspnet_UsersInRoles  Used by the SQL Role Provider to map roles to users.
aspnet_WebEvent_Events  Used by the SQL Web Event Provider to log event data.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Views
Name  Description 
vw_aspnet_Applications  Displays information for all applications.
vw_aspnet_MembershipUsers  Displays a list of ASP.NET membership users associated with the unique identifier for the user.
vw_aspnet_Profiles  Displays user profile information.
vw_aspnet_Roles  Displays role information.
vw_aspnet_Users  Displays a list of users per application.
vw_aspnet_UsersInRoles  Displays which users are associated with which roles by the unique identifiers for the user and the role.
vw_aspnet_WebPartState_Paths  Displays Web Parts state path information.
vw_aspnet_WebPartState_Shared  Displays Web Parts state information.
vw_aspnet_WebPartState_User  Displays Web Parts user information.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The aspnet_Applications table
 
Column NameColumn TypeDescription
ApplicationIduniqueidentifierApplication ID
ApplicationNamenvarchar(256)Application name
LoweredApplicationNamenvarchar(256)Application name (lowercase)
Descriptionnvarchar(256)Application descriptio

Relationships

Primary Table  Primary Key  Foreign Table  Foreign Key 
aspnet_Applications  ApplicationId  aspnet_Users  ApplicationId 
aspnet_Applications  ApplicationId  aspnet_Membership  ApplicationId 
aspnet_Applications  ApplicationId  aspnet_Roles  ApplicationId 
aspnet_Applications  ApplicationId  aspnet_Paths  ApplicationId 

Referencing Views

Name 
vw_aspnet_Applications 

The aspnet_Membership table
SqlMembershipProvider stores membership data in the aspnet_Membership table of the provider database. Each record in aspnet_Membership corresponds to one membership user.
Column NameColumn TypeDescription
ApplicationIduniqueidentifierApplication ID
UserIduniqueidentifierUser ID
Passwordnvarchar(128)Password (plaintext, hashed, or encrypted; base-64-encoded if hashed or encrypted)
PasswordFormatintPassword format (0=Plaintext, 1=Hashed, 2=Encrypted)
PasswordSaltnvarchar(128)Randomly generated 128-bit value used to salt password hashes; stored in base-64-encoded form
MobilePINnvarchar(16)User's mobile PIN (currently not used)
Emailnvarchar(256)User's e-mail address
LoweredEmailnvarchar(256)User's e-mail address (lowercase)
PasswordQuestionnvarchar(256)Password question
PasswordAnswernvarchar(128)Answer to password question
IsApprovedbit1=Approved, 0=Not approved
IsLockedOutbit1=Locked out, 0=Not locked out
CreateDatedatetimeDate and time this account was created
LastLoginDatedatetimeDate and time of this user's last login
LastPasswordChangedDatedatetimeDate and time this user's password was last changed
LastLockoutDatedatetimeDate and time this user was last locked out
FailedPasswordAttemptCountintNumber of consecutive failed login attempts
FailedPasswordAttempt-WindowStartdatetimeDate and time of first failed login if FailedPasswordAttemptCount is nonzero
FailedPasswordAnswer-AttemptCountintNumber of consecutive failed password answer attempts
FailedPasswordAnswer-AttemptWindowStartdatetimeDate and time of first failed password answer if FailedPasswordAnswerAttemptCount is nonzero
CommentntextAdditional text

Relationships

Primary Table  Primary Key  Foreign Table  Foreign Key 
aspnet_Applications  ApplicationId  aspnet_Membership  ApplicationId 
aspnet_Users  UserId  aspnet_Membership  UserId 

 

Referencing Views

Name 
vw_aspnet_MembershipUsers 

The aspnet_Users table
Column NameColumn TypeDescription
ApplicationIduniqueidentifierApplication ID
UserIduniqueidentifierUser ID
UserNamenvarchar(256)User name
LoweredUserNamenvarchar(256)User name (lowercase)
MobileAliasnvarchar(16)User's mobile alias (currently not used)
IsAnonymousbit1=Anonymous user, 0=Not an anonymous user
LastActivityDatedatetimeDate and time of last activity by this user

Relationships

Primary Table  Primary Key  Foreign Table  Foreign Key 
aspnet_Applications  ApplicationId  aspnet_Users  ApplicationId 
aspnet_Users  UserId  aspnet_Membership  UserId 
aspnet_Users  UserId  aspnet_Profile  UserId 
aspnet_Users  UserId  aspnet_UsersInRoles  UserId 
aspnet_Users  UserId  aspnet_PersonalizationPerUser  UserId 

Referencing Views

Name 
vw_aspnet_MembershipUsers 
vw_aspnet_Users 


Stored procedures used by SqlMembershipProvider
Stored ProcedureDescription
aspnet_Membership_ChangePassword-QuestionAndAnswerChanges the specified user's password question and answer.
aspnet_Membership_CreateUserAdds a new membership user to the membership database. Records the user in the aspnet_Users and aspnet_Membership tables and, if necessary, adds a new application to the aspnet_Applications table.
aspnet_Membership_FindUsersByEmailRetrieves records from aspnet_Membership table with e-mail addresses matching the specified pattern and with the specified application ID.
aspnet_Membership_FindUsersByNameRetrieves records from aspnet_Membership table with user names matching the specified pattern and with the specified application ID.
aspnet_Membership_GetAllUsersRetrieves all users from the aspnet_Membership table with the specified application ID.
aspnet_Membership_GetNumberOfUsersOnlineGets the number of users currently online (those whose last activity dates.
aspnet_Membership_GetPasswordGets the specified user's password data from the database. Used for retrieving passwords with a user-supplied password answer.
aspnet_Membership_GetPasswordWithFormatGets the specified user's password from the database. Used by the provider to retrieve passwords for performing password comparisons (for example, when ValidateUser needs to validate a password).
aspnet_Membership_GetUserByEmailGiven an e-mail address and application ID, retrieves the corresponding record from the aspnet_Membership table.
aspnet_Membership_GetUserByNameGiven a user name and application ID, retrieves the corresponding record from the aspnet_Membership table.
aspnet_Membership_GetUserByUserIdGiven a user ID and application ID, retrieves the corresponding record from the aspnet_Membership table.
aspnet_Membership_ResetPasswordResets the specified user's password based on a password answer.
aspnet_Membership_SetPasswordSets the specified user's password to the password input to the stored procedure.
aspnet_Membership_UnlockUserRestores login privileges for the specified user by setting the user's IsLockedOut bit to 0.
aspnet_Membership_UpdateUserUpdates the user's last activity date in the aspnet_Users table and e-mail address, comment, is-approved status, and last login date in the aspnet_Membership table.
aspnet_Membership_UpdateUserInfoUpdates account locking data for the specified user in the aspnet_Users and aspnet_Membership tables. Used in conjunction with provider methods that track bad password and bad password-answer attempts.
aspnet_Users_CreateUserAdds a user to the aspnet_Users table. Called by aspnet_Membership_CreateUser.
aspnet_Users_DeleteUserDeletes a user from the aspnet_Membership table and optionally from other SQL provider tables, including aspnet_Users.

Relationships


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The aspnet_Roles table
Column NameColumn TypeDescription
ApplicationIduniqueidentifierApplication ID
RoleIduniqueidentifierRole ID
RoleNamenvarchar(256)Role name
LoweredRoleNamenvarchar(256)Role name (lowercase)
Descriptionnvarchar(256)Role description (currently unused)

Relationships

Primary Table  Primary Key  Foreign Table  Foreign Key 
aspnet_Applications  ApplicationId  aspnet_Roles  ApplicationId 
aspnet_Roles  RoleId  aspnet_UsersInRoles  RoleId 

Referencing Views

Name 
vw_aspnet_Roles 


The aspnet_UsersInRoles table
Column NameColumn TypeDescription
UserIduniqueidentifierUser ID
RoleIduniqueidentifierRole ID


Relationships

Primary Table  Primary Key  Foreign Table  Foreign Key 
aspnet_Users  UserId  aspnet_UsersInRoles  UserId 
aspnet_Roles  RoleId  aspnet_UsersInRoles  RoleId 


Referencing Views

Name 
vw_aspnet_UsersInRoles 

Stored procedures used by SqlRoleProvider
Stored ProcedureDescription
aspnet_Roles_CreateRoleAdds a role to the aspnet_Roles table and, if necessary, adds a new application to the aspnet_Applications table.
aspnet_Roles_DeleteRoleRemoves a role from the aspnet_Roles table. Optionally deletes records referencing the deleted role from the aspnet_UsersInRoles table.
aspnet_Roles_GetAllRolesRetrieves all roles with the specified application ID from the aspnet_Roles table.
aspnet_Roles_RoleExistsChecks the aspnet_Roles table to determine whether the specified role exists.
aspnet_UsersInRoles_AddUsersToRolesAdds the specified users to the specified roles by adding them to the aspnet_UsersInRoles table.
aspnet_UsersInRoles_FindUsersInRoleQueries the aspnet_UsersInRoles table for all users belonging to the specified role whose user names match the specified pattern.
aspnet_UsersInRoles_GetRolesForUserQueries the aspnet_UsersInRoles table for all roles assigned to a specified user.
aspnet_UsersInRoles_GetUsersInRolesQueries the aspnet_UsersInRoles table for all users belonging to the specified role.
aspnet_UsersInRoles_IsUserInRoleChecks the aspnet_UsersInRoles table to determine whether the specified user belongs to the specified role.
aspnet_UsersInRoles_RemoveUsersFromRolesRemoves the specified users from the specified roles by deleting the corresponding records from the aspnet_UsersInRoles table.


Relationships: membership and roles 


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The aspnet_Profile table
Column NameColumn TypeDescription
UserIduniqueidentifierID of the user to which this profile data pertains
PropertyNamesntextNames of all property values stored in this profile
PropertyValuesStringntextValues of properties that could be persisted as text
PropertyValuesBinaryimageValues of properties that were configured to use binary serialization
LastUpdatedDatedatetimeDate and time this profile was last updated


Relationships

Primary Table  Primary Key  Foreign Table  Foreign Key 
aspnet_Users  UserId  aspnet_Profile  UserId 


Referencing Views

Name 
vw_aspnet_Profiles 

Stored procedures used by SqlProfileProvider
Stored ProcedureDescription
aspnet_Profile_DeleteInactiveProfilesDeletes profile data from the aspnet_Profile table for users whose last activity dates in the aspnet_Users table fall on or before the specified date.
aspnet_Profile_DeleteProfilesDeletes profile data from the aspnet_Profile table for the specified users.
aspnet_Profile_GetNumberOfInactiveProfilesQueries the aspnet_Profile table to get a count of profiles whose last activity dates (in the aspnet_Users table) fall on or before the specified date.
aspnet_Profile_GetProfilesRetrieves profile data from the aspnet_Profile table for users who match the criteria input to the stored procedure.
aspnet_Profile_GetPropertiesRetrieves profile data for the specified user.
aspnet_Profile_SetPropertiesSaves profile data for the specified user.


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The aspnet_PersonalizationPerUser table
Column NameColumn TypeDescription
IduniqueidentifierID of this record
PathIduniqueidentifierID of the virtual path to which this state pertains
UserIduniqueidentifierID of the user to which this state pertains
PageSettingsimageSerialized personalization state
LastUpdatedDatedatetimeDate and time state was saved

Relationships

Primary Table  Primary Key  Foreign Table  Foreign Key 
aspnet_Paths  PathId  aspnet_PersonalizationPerUser  PathId 
aspnet_Users  UserId  aspnet_PersonalizationPerUser  UserId 

Referencing Views

Name 
vw_aspnet_WebPartState_User 

The aspnet_PersonalizationAllUsers table
Column NameColumn TypeDescription
PathIduniqueidentifierID of the virtual path to which this state pertains
PageSettingsimageSerialized personalization state
LastUpdatedDatedatetimeDate and time state was saved

Relationships

Primary Table  Primary Key  Foreign Table  Foreign Key 
aspnet_Paths  PathId  aspnet_PersonalizationAllUsers  PathId 


Referencing Views

Name 
vw_aspnet_WebPartState_Shared 

The aspnet_Paths table
Column NameColumn TypeDescription
ApplicationIduniqueidentifierApplication ID
PathIduniqueidentifierPath ID
Pathnvarchar(256)Path name
LoweredPathnvarchar(256)Path name (lowercase)


Relationships

Primary Table  Primary Key  Foreign Table  Foreign Key 
aspnet_Applications  ApplicationId  aspnet_Paths  ApplicationId 
aspnet_Paths  PathId  aspnet_PersonalizationAllUsers  PathId 
aspnet_Paths  PathId  aspnet_PersonalizationPerUser  PathId 


Referencing Views

Name 
vw_aspnet_WebPartState_Paths 
Stored procedures used by SqlPersonalizationProvider
Stored ProcedureDescription
aspnet_PersonalizationAdministration_DeleteAllStateDeletes all records from aspnet_PersonalizationAllUsers or aspnet_PersonalizationPerUser corresponding to the specified application ID.
aspnet_PersonalizationAdministration_FindStateRetrieves profile data from aspnet_PersonalizationAllUsers or aspnet_PersonalizationPerUser meeting several input criteria.
aspnet_PersonalizationAdministration_GetCountOfStateReturns a count of records in the aspnet_PersonalizationAllUsers table with path names matching the specified pattern, or a count of records in the aspnet_PersonalizationPerUser table meeting several input criteria.
aspnet_PersonalizationAdministration_ResetSharedStateResets shared state for the specified page, by deleting the corresponding record from the aspnet_PersonalizationAllUsers table.
aspnet_PersonalizationAdministration_ResetUserStateResets per-user state for the specified user and the specified page, by deleting the corresponding record from the aspnet_PersonalizationPerUser table. Can also delete records, based on the user's last activity date if it falls on or before the specified date.
aspnet_PersonalizationAllUsers_GetPageSettingsRetrieves shared state for the specified page from the aspnet_PersonalizationAllUsers table.
aspnet_PersonalizationAllUsers_ResetPageSettingsResets shared state for the specified page, by deleting the corresponding record from the aspnet_PersonalizationAllUsers table.
aspnet_PersonalizationAllUsers_SetPageSettingsSaves shared state for the specified page in the aspnet_PersonalizationAllUsers table.
aspnet_PersonalizationPerUser_GetPageSettingsRetrieves per-user state for the specified page and the specified user from the aspnet_PersonalizationPerUser table.
aspnet_PersonalizationPerUser_ResetPageSettingsResets per-user state for the specified page and the specified user, by deleting the corresponding record from the aspnet_PersonalizationPerUser table.
aspnet_PersonalizationPerUser_SetPageSettingsSaves per-user state for the specified page and the specified user in the aspnet_PersonalizationPerUser table.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The aspnet_WebEvent_Events table
Column NameColumn TypeDescription
EventIdchar(32)Event ID (from WebBaseEvent.EventId)
EventTimeUtcdatetimeUTC time at which the event was fired (from WebBaseEvent.EventTimeUtc)
EventTimedatetimeLocal time at which the event was fired (from WebBaseEvent.EventTime)
EventTypenvarchar(256)Event type (for example, WebFailureAuditEvent)
EventSequencedecimal(19,0)Event sequence number (from WebBaseEvent.EventSequence)
EventOccurrencedecimal(19,0)Event occurrence count (from WebBaseEvent.EventOccurrence)
EventCodeintEvent code (from WebBaseEvent.EventCode)
EventDetailCodeintEvent detail code (from WebBaseEvent.EventDetailCode)
Messagenvarchar(1024)Event message (from WebBaseEvent.EventMessage)
ApplicationPathnvarchar(256)Physical path of the application that generated the Web event (for example, C:\Websites\MyApp)
ApplicationVirtualPathnvarchar(256)Virtual path of the application that generated the event (for example, /MyApp)
MachineNamenvarchar(256)Name of the machine on which the event was generated
RequestUrlnvarchar(1024)URL of the request that generated the Web event
ExceptionTypenvarchar(256)If the Web event is a WebBaseErrorEvent, type of exception recorded in the ErrorException property; otherwise, DBNull
DetailsntextText generated by calling ToString on the Web event

Stored procedure used by SqlWebEventProvider
Stored ProcedureDescription
aspnet_WebEvent_LogEventRecords a Web event in the aspnet_WebEvents_Events table.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The aspnet_SchemaVersions table
Name  Type  Required?  Defaults To  Description 
Feature  nvarchar(128)  Yes  Name of the application feature
CompatibleSchemaVersion  nvarchar(128)  Yes  Schema version required for compatibility
IsCurrentVersion  bit  Yes  1=Current version, 0=Not current version

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Brak komentarzy:

Prześlij komentarz