G
Guest
I'm building an n-Layer application that may be segmented into n-Tiers. For
the user interface I'm implementing an MVC architecture.
Since I can't access the page class directly from another class, is there a
way to put items in the viewstate without writing a function in the aspx page?
i.e. I can do the following
Public MustInherit Class EditViewBase
Inherits System.Web.UI.Page
Public MustOverride Property Persist(ByVal key As String) As Object
End Class
Partial Class Edit
Inherits EditViewBase
Public Overrides Property Persist(ByVal key As String) As Object
Get
Return ViewState(key)
End Get
Set(ByVal value As Object)
ViewState(key) = value
End Set
End Property
End Class
But I have to put that on every page. Is there a way to simplify or
abstract this?
Question 2 is, how do people in general handle null values in a model from
the database to the screen and back? I could implement everything as a
string and use an empty string to reflect a null, but most examples of model
classes I've seen do something like the following:
Class Model
Private _age As Integer
Public Property Age() As Integer
Get
Return _age
End Get
Set(ByVal value As Integer)
_age = value
End Set
End Property
End Class
But I don't see a clean way of tracking if the Property is NULL or undefined.
Thanks for any insight.
the user interface I'm implementing an MVC architecture.
Since I can't access the page class directly from another class, is there a
way to put items in the viewstate without writing a function in the aspx page?
i.e. I can do the following
Public MustInherit Class EditViewBase
Inherits System.Web.UI.Page
Public MustOverride Property Persist(ByVal key As String) As Object
End Class
Partial Class Edit
Inherits EditViewBase
Public Overrides Property Persist(ByVal key As String) As Object
Get
Return ViewState(key)
End Get
Set(ByVal value As Object)
ViewState(key) = value
End Set
End Property
End Class
But I have to put that on every page. Is there a way to simplify or
abstract this?
Question 2 is, how do people in general handle null values in a model from
the database to the screen and back? I could implement everything as a
string and use an empty string to reflect a null, but most examples of model
classes I've seen do something like the following:
Class Model
Private _age As Integer
Public Property Age() As Integer
Get
Return _age
End Get
Set(ByVal value As Integer)
_age = value
End Set
End Property
End Class
But I don't see a clean way of tracking if the Property is NULL or undefined.
Thanks for any insight.