English 中文(简体)
提供严格分类的出席会议物体
原标题:Provide strongly typed access to the session object

提供严格分类的与会机会的最佳方式是什么? 我正计划转而选择矩阵,这正在促使汇编者抱怨我的 la方案规划方法,即直接接触会议的目标:

Dim blah As Integer = Session("Blah")

我最初的想法是建立一个总结会议并为本届会议储存的信息提供严格分类的类别。 然而,我不能决定该类别是否应当是一个单一州,还是应当就每个用途进行即时处理,或者该代码应当居住的地方(即在网络项目内或某一级图书馆内)。

我向我的班子图书馆的单一吨位出租,但我不知道这是否是最佳解决办法,或者如果我没有其他可能性。

拟议解决办法:

Public Class SessionAccess
    Public Shared Property Blah(ByVal session As HttpSessionState) As Integer
        Get
            Return Convert.ToInt32(session("Blah"))
        End Get
        Set(ByVal value As Integer)
            session("Blah") = value
        End Set
    End Property
End Class

加入:

Dim blah As Integer = SessionAccess.Blah(session)
最佳回答
问题回答

我删除了我原来的回答,因为“Jason Berkan”在质疑我的回答时非常好。 贾森认为,这一想法是正确的。

我在你的法典例中唯一要改变的是检查,以确保会议有变数。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签