理由的背后IReadOnlySessionState [英] Rationale Behind IReadOnlySessionState

查看:72
本文介绍了理由的背后IReadOnlySessionState的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是实现了一个使用IReadOnlySessionState的处理程序,并想知道为什么需要这个标记接口。 (据我所知,这是必要的,以访问会话变量,我的问题是,这是为什么从框架设计者的角度看)我的想法是,它是如此的处理程序可以尽可能地瘦,要求他们选入如果他们想利用会话状态,但我想知道如果也许我失去了别的东西。

I just implemented a handler that uses IReadOnlySessionState and was wondering why this marker interface is needed. (I understand that it is needed in order to access Session variables, my question is why is this from a framework designer's perspective) My thinking is that it is so handlers can be as lean as possible, requiring them to "opt-in" if they want to make use of session-state, but I'm wondering if perhaps I'm missing something else.

推荐答案

是的,据我所知,你是正确的。无论 IReadOnlySessionState IRequiresSessionState 是保护你让你的处理程序较重,而标记接口速度较慢。

Yes, AFAIK, you are correct. Both IReadOnlySessionState and IRequiresSessionState are marker interfaces that protect you from making your handler heavier, and slower.

它们之间的区别仅仅是会议的写入状态。

The difference between them is only the write status of the session.

这篇关于理由的背后IReadOnlySessionState的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆