E
Evian Spring
We are planning on using "SqlServer" mode for our ASP.NET session
state.
I know for the classes we store in Session that I need to mark them
with the SerializableAttribute as described in this knowledge base
article:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;q312112&ID=KB;EN-US;q312112
My question is, if I store in session a class that contains members
that are classes and so on, will marking my class with the
SerializableAttribute the only thing I need?
I have written a simple class shown below.....will marking
MyClassExample with SerializableAttribute the only thing I need? I
think the member variable that are not object will serialize no problem
but I not sure for Class1 in my exmaple below...........I know I may
need to implement the ISerializable interface to control the
serialization process but I haven't found good examples on how to do
this yet.
Public Class MyClassExample
Private _MemberVariable_Of_Type_Integer As Integer
Private _MemberVariable_Of_Type_String As String
Private _MemberVariable_Of_Type_Class1 As Class1
Public Property MemberVariable_Of_Type_Integer() As Integer
Get
Return _MemberVariable_Of_Type_Integer
End Get
Set(ByVal value As Integer)
_MemberVariable_Of_Type_Integer = value
End Set
End Property
Public Property MemberVariable_Of_Type_String() As String
Get
Return _MemberVariable_Of_Type_String
End Get
Set(ByVal value As String)
_MemberVariable_Of_Type_String = value
End Set
End Property
Public Property MemberVariable_Of_Type_Class1() As Class1
Get
Return _MemberVariable_Of_Type_Class1
End Get
Set(ByVal value As Class1)
_MemberVariable_Of_Type_Class1 = value
End Set
End Property
Public Sub New()
Me.MemberVariable_Of_Type_Integer = -1
Me.MemberVariable_Of_Type_String = ""
Me.MemberVariable_Of_Type_Class1 = New Class1()
End Sub
End Class
state.
I know for the classes we store in Session that I need to mark them
with the SerializableAttribute as described in this knowledge base
article:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;q312112&ID=KB;EN-US;q312112
My question is, if I store in session a class that contains members
that are classes and so on, will marking my class with the
SerializableAttribute the only thing I need?
I have written a simple class shown below.....will marking
MyClassExample with SerializableAttribute the only thing I need? I
think the member variable that are not object will serialize no problem
but I not sure for Class1 in my exmaple below...........I know I may
need to implement the ISerializable interface to control the
serialization process but I haven't found good examples on how to do
this yet.
Public Class MyClassExample
Private _MemberVariable_Of_Type_Integer As Integer
Private _MemberVariable_Of_Type_String As String
Private _MemberVariable_Of_Type_Class1 As Class1
Public Property MemberVariable_Of_Type_Integer() As Integer
Get
Return _MemberVariable_Of_Type_Integer
End Get
Set(ByVal value As Integer)
_MemberVariable_Of_Type_Integer = value
End Set
End Property
Public Property MemberVariable_Of_Type_String() As String
Get
Return _MemberVariable_Of_Type_String
End Get
Set(ByVal value As String)
_MemberVariable_Of_Type_String = value
End Set
End Property
Public Property MemberVariable_Of_Type_Class1() As Class1
Get
Return _MemberVariable_Of_Type_Class1
End Get
Set(ByVal value As Class1)
_MemberVariable_Of_Type_Class1 = value
End Set
End Property
Public Sub New()
Me.MemberVariable_Of_Type_Integer = -1
Me.MemberVariable_Of_Type_String = ""
Me.MemberVariable_Of_Type_Class1 = New Class1()
End Sub
End Class