ASP.NET SQL Server 模式下延迟加载会话变量
我想知道 SQL 模式下的 ASP.NET 会话提供程序是否会乐观地获取整个会话状态对象(即,当我们请求一个会话状态对象时,所有键及其值)或以惰性方式获取它们(即,转到数据库并仅获取请求的键和相应的值)?
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 lazy fashion (i.e goes to the Database and fetch only the requested key and corresponding value)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我像这样安装了 SQL 的 SQL 会话状态:
下面是安装的“选择”存储过程之一。我试图理解它。
在我看来,用户的整个会话状态被序列化并存储在一个数据库记录中。这意味着将加载用户的整个会话状态以便访问任何记录。
我猜测它可能是在 ASP.net 页面或应用程序生命周期的早期阶段默认加载的(也许仅当编译器识别出任何页面代码中对 Session() 的访问时)。
这是存储会话数据的表,供参考:
I installed the SQL Session State for SQL like this:
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: