<Serializable()> _
Public
Class CSSUserTypeList Inherits NameValueListBase(Of Integer, String)#Region
" Business Methods "#End
Region#Region
" Factory Methods " Private Shared mList As CSSUserTypeList Public Shared Function GetList() As CSSUserTypeList If mList Is Nothing Then mList = DataPortal.Fetch(Of CSSUserTypeList)(New Criteria(GetType(CSSUserTypeList))) 'If mList Is Nothing Then ' mList = DataPortal.Fetch(Of CSSUserTypeList)() 'End If Return mList End Function Public Shared Sub InvalidateCache()mList =
Nothing End Sub Private Sub New() 'required End Sub#End
Region#Region
" Data Access " Private Overloads Sub DataPortal_Fetch(ByVal criteria As Criteria) Me.RaiseListChangedEvents = False Using cn As New SqlConnection(HSAConnectionString)cn.Open()
Using cm As SqlCommand = cn.CreateCommandcm.CommandType = CommandType.StoredProcedure
cm.CommandText =
"_NameValueList_Get"cm.Parameters.AddWithValue(
"@TableName", "CSSUserType") Using dr As New SafeDataReader(cm.ExecuteReader)IsReadOnly =
False With dr While .Read() Me.Add(New NameValuePair(.GetInt32("CSSUserTypeID"), .GetString("CSSUserTypeDesc"))) End While End WithIsReadOnly =
True End Using End Using End Using Me.RaiseListChangedEvents = True End Sub#End
RegionEnd
ClassI get the error The underlying connection was closed: The connection was closed unexpectedly at the DataPortal.Fetch
I added some tracing and I get the following
Type 'CSSV2.Library.CSSUserTypeList' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.
Any help would be appreciated.
I don't see any obvious issue around serialization...
I'd try running the code with a local data portal, or with remote web debugging enabled, so you can put a breakpoint in DP_Fetch() and see if that code works properly.
Copyright (c) Marimer LLC