Find out the main backend of ASP. NET 2.0 "ins"-aspnetdb
Database relationship diagram, tables, and views (1) Basic Tables and independent tables
Aspnetdb is hidden in the four plug-ins of ASP. NET 2.0"
(
Sqlmembershipprovider,
Sqlroleprovider,
Sqlprofileprovider,
Sqlpersonalizationprovider
)
Then, from time to time, the ghost SQL database appears in your app_data directory, in fact, there is nothing magical,
I waited for the common saying to go in and see it. However, if we want to write a custom provider,
We still need to carefully study the logic, because most of the business logic of the four providers is still "encapsulated" in this database.
Next, let me be the younger brother and help you understand 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 DiagramThis figure is quite important. When you look at the following content, you should always come back and check it out.Table
Several tables in the aspnetdb database are called lowered ** fields,
These fields are used to store the *** lowercase copy of string fields.
Because the comparison of these *** string fields is case-insensitive, a lowercase copy is stored in the table,
It can increase the speed of string comparison.
Basic Tables aspnet_application and aspnet_users
- Each provider in the application table has an applicationname attribute, which is generally defined in Web. config.
Example of a profileprovider (the same is true for the other three providers ):<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, you register a "webshop" name for your application.
(You can also not explicitly configure the applicationname value. The default value is the virtual root path of the application, that is "/").
Note that if you change "webshop" to "webshop1" that day"
(Changing to "webshop" or "webshop" is the same as not changing, because the application name is case insensitive ),
The custom attribute values of your previous users evaporate, because profileprovider puts "webshop1"
I registered it again as a new application (this is my brother who has read this article ).
You 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.
- The mobilealias field in the basic user table (and the mobilepin field in the aspnet_membership table ),
I haven't seen it. The younger brother guessed that Microsoft had two possibilities for doing so: one was to bind a later account to a mobile phone,
Another possibility is reserved for accessing the Internet through a mobile phone.I do not know whether DBAs have seen the relationship between this table and several slave tables. It is a bit unreasonable ",
There are two one-to-one relationships. "Why not merge? Do not know the 3rd paradigm ?", Younger brother
I used to scare the younger brother when I wanted to install a cultural person. A few years later, when the younger brother saw a few
The architecture/Model Book, after self-literacy, knows that this is actually one of the ORM models.
In addition, the design by Microsoft engineers is still very clever. After you extract the public part 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,
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 and will be updated every successful operation,
It is also one of the bases for determining whether a user is a non-active user. It is used by many stored procedures.
Before describing most of the four 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 it and you will know it at a glance. It turns out that Microsoft has set the version number for each part of the database.