54 lines
1.7 KiB
VB.net
54 lines
1.7 KiB
VB.net
Imports ORPublicApiRefCore
|
|
|
|
Public Module modOHCommon
|
|
|
|
|
|
<ThreadStatic> Private _rstData As List(Of KeyValuePair(Of String, DTRecordSet))
|
|
Public Property rs(ByVal uniqueIdent As String) As DTRecordSet
|
|
Get
|
|
Return rstData(uniqueIdent)
|
|
End Get
|
|
Set(value As DTRecordSet)
|
|
rstData(uniqueIdent) = value
|
|
End Set
|
|
End Property
|
|
Public Property rstData(ByVal uniqueIdent As String) As DTRecordSet
|
|
Get
|
|
Dim localRs As List(Of KeyValuePair(Of String, DTRecordSet))
|
|
|
|
If _rstData Is Nothing Then
|
|
_rstData = New List(Of KeyValuePair(Of String, DTRecordSet))
|
|
End If
|
|
localRs = _rstData
|
|
|
|
For Each kvp As KeyValuePair(Of String, DTRecordSet) In localRs
|
|
If kvp.Key = uniqueIdent Then
|
|
Return kvp.Value
|
|
End If
|
|
Next kvp
|
|
'Throw New Exception("rstData(" & uniqueIdent & ") could not be found")
|
|
Return Nothing
|
|
End Get
|
|
Set(ByVal value As DTRecordSet)
|
|
Dim localRs As List(Of KeyValuePair(Of String, DTRecordSet))
|
|
|
|
If _rstData Is Nothing Then
|
|
_rstData = New List(Of KeyValuePair(Of String, DTRecordSet))
|
|
End If
|
|
localRs = _rstData
|
|
|
|
'remove from list if exists, then replace
|
|
For Each kvp As KeyValuePair(Of String, DTRecordSet) In localRs
|
|
If kvp.Key = uniqueIdent Then
|
|
localRs.Remove(kvp)
|
|
Exit For
|
|
End If
|
|
Next kvp
|
|
Dim wrapKVP As New KeyValuePair(Of String, DTRecordSet)(uniqueIdent, value)
|
|
localRs.Add(wrapKVP)
|
|
End Set
|
|
End Property
|
|
|
|
|
|
End Module
|