aspnetdb is hidden in ASP. after the four plug-ins of NET 2.0 (sqlmembershipprovider, sqlroleprovider, sqlprofileprovider, and sqlpersonalizationprovider), the ghost-like SQL database appears in your app_data directory from time to time. In fact, there is nothing magical about it, I waited for the common saying to go in and see it. However, if we want to write a custom provider, We have to carefully study the vendor, because most of the business logic of the four providers is "encapsulated" in this database.
now, let me know the tables, views, and stored procedures.
Note: there is also sqlwebeventprovider, which uses the aspnet_webevent_events table and the storage process aspnet_webevent_logevent.
because the younger brother thinks that writing local files is a better choice in terms of performance, it is not described here.
In addition, there is a sitemapprovider unrelated to aspnetdb, which is mainly used with controls such as sitemappath to store site maps in XML files.
View A "map" first:
Database Relationship Diagram
This figure is quite important. When you look at the following content, you should always come back and check it out.
Table
In several tables of the aspnetdb database, the fields are called lowered **. These fields are used to store the lowercase copies of the *** string fields. Because the comparison of these *** string fields is case-insensitive, you can store a lowercase copy in the table to increase the speed of string comparison.
Basic Tables aspnet_application and aspnet_users
1. application table
Each provider has an applicationname attribute, which is generally defined in Web. config. Example of a profileprovider (the same is true for the other three providers ):
Web. config
< System . Web >
< Connectionstrings >
< Add Name = "Sqlsrvconnectionstring" Connectionstring = "" />
</ Connectionstrings >
< Profile Defaultprovider = "Sqlsrvprofileprovider" >
< Providers >
< Add Name = "Sqlsrvprofileprovider"
Type = "System. Web. Security. sqlprofileprovider"
Connectionstringname = "Sqlsrvconnectionstring"
Applicationname = "Webshop"
Commandtimeout = "30"
Description = "Sqlsrvprofileprovider" />
</ Providers >
< Properties >
</ Properties >
</ Profile >
</ System. Web >
In this way, your applicationProgramYou have registered a "webshop" Name (or you may not explicitly configure the applicationname value. The default value is the virtual root path of the application, that is "/"). It should be noted that if you changed "webshop" to "webshop1" that day (to "webshop", "webshop", and so on, it would be the same as you did not change it, because the application name is case-insensitive), your previous user-defined property values evaporate, because profileprovider regards "webshop1" as a new application and registers it again (at this time, I read this article)ArticleYou should know what to do, haha ).
Do the four providers have to be configured with the same applicationname? Of course not necessary! It does not matter if you create a database for each provider. What's more, the applicationname value in the zone is used. However, the old brother suggests that you do not have to look for anything, but you should give them the same name.
2. Basic User table
the mobilealias field in the table (and the mobilepin field in the aspnet_membership table) is not used in the table. The younger brother guessed that Microsoft had two possibilities for doing so: one was to bind the account to the mobile phone in the future, and the other was reserved for the mobile phone to access the Internet.
I do not know whether DBAs have seen the relationship between the table and its slave tables. It is a bit unreasonable. Actually, there are two one-to-one relationships. "Why not merge? Do not know the 3rd paradigm ?", When I used to pretend to be a cultural person, my younger brother always gave me the fear. A few years later, when I read a few books on architecture/model and read Self-literacy, I realized that this is actually one of the ORM models.
In addition, the design by Microsoft engineers is still very clever. After the public part is extracted into several basic tables, the four parts of the database relationship diagram can be split. You can try to cover some parts in the database relationship diagram, and the rest can still be a complete system.
Finally, let's talk about the isanonymous and lastactivitydate fields. Because personalized user configuration and page personalized settings support anonymous users, the table also contains anonymous users. The isanonymous field indicates whether the user is an anonymous user. The lastactivitydate field records the last activity time of the user. This field is very important. It will be updated every successful operation, and it is also one of the basis for determining whether a user is not an active user. It is used by many stored procedures.
before describing the majority of parts, let me briefly introduce two independent tables:
aspnet_webevent_events table: event Logs that record data operations (which can be enabled by sqlwebeventprovider ).
aspnet_schemaversions table:
paste the content of this table. It turns out that Microsoft has set the version number for each part of the database.