ASP.NET SQL Server 模式下延迟加载会话变量

发布于 2024-09-16 15:16:27 字数 109 浏览 0 评论 0原文

我想知道 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

橘香 2024-09-23 15:16:27

我像这样安装了 SQL 的 SQL 会话状态:

aspnet_regsql.exe -sstype c -ssadd -d mydatabase -U MyUserName -P MyPassword -S xx.xx.xx.xxx

下面是安装的“选择”存储过程之一。我试图理解它。

在我看来,用户的整个会话状态被序列化并存储在一个数据库记录中。这意味着将加载用户的整个会话状态以便访问任何记录。

我猜测它可能是在 ASP.net 页面或应用程序生命周期的早期阶段默认加载的(也许仅当编译器识别出任何页面代码中对 Session() 的访问时)。

在此处输入图像描述

这是存储会话数据的表,供参考:

在此处输入图像描述

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).

enter image description here

Here's the table where the session data gets stored, for reference:

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文