Lazy loading of Session variables in ASP.NET SQL Server Mode
Would like to know whether the ASP.NET Session Provider in SQL Mode, would optimistically fetch the entire Session State object (i.e all the keys and their values when we request one) or fetch them in a la开发者_JAVA百科zy fashion (i.e goes to the Database and fetch only the requested key and corresponding value)?
I installed the SQL Session State for SQL like this:
aspnet_regsql.exe -sstype c -ssadd -d mydatabase -U MyUserName -P MyPassword -S xx.xx.xx.xxx
Below is one of the "select" Stored Procedures that gets installed. I tried to make some sense of it.
It appears to me that a user's entire session state is serialized and stored in one database record. This would mean the user's entire session state would be loaded in order to access any record.
I am guessing that it is probably loaded by default during the early stages of the ASP.net page or application life-cycle (perhaps only if the compiler recognized access to Session() in any of the page's code).
Here's the table where the session data gets stored, for reference:
精彩评论