This question is locked. New answers and comments are not allowed.
Hi,
I 'm encountered a problem while i'm mapping a property that is a custom collection class Similar post i found in the forum is
Strongly typed collection classes and OpenAccess forward mapping
The solution gave above is changed the data type of property from custom collection class to IList(of Object). But how if i want to maintain the structure of my classes and map it with OA? I want all the collection property refer to a custom collection class, so that i can add some generic function in it.
These are my classes.
BusinessBase Class:
BusinessCollection Class:
Guest Class: Here is the Addresses property refered to custom collection class
Address Class:
AddressCollection Class:
I 'm encountered a problem while i'm mapping a property that is a custom collection class Similar post i found in the forum is
Strongly typed collection classes and OpenAccess forward mapping
The solution gave above is changed the data type of property from custom collection class to IList(of Object). But how if i want to maintain the structure of my classes and map it with OA? I want all the collection property refer to a custom collection class, so that i can add some generic function in it.
These are my classes.
BusinessBase Class:
Public MustInherit Class BusinessBase |
Private _IsValid As Boolean = False |
Public Property IsValid() As Boolean |
Get |
Return _IsValid |
End Get |
Set(ByVal value As Boolean) |
_IsValid = value |
End Set |
End Property |
Public Overridable Sub Validate() |
End Sub |
End Class |
BusinessCollection Class:
Imports System.Collections.ObjectModel |
Public Class BusinessCollectionBase(Of T As BusinessBase) |
Inherits Collection(Of T) |
End Class |
Guest Class: Here is the Addresses property refered to custom collection class
<Telerik.OpenAccess.Persistent(IdentityField:="_Guest_Id")> _ |
Public Class Guest |
Inherits BusinessBase |
Private _Guest_Id As String = String.Empty |
Private _FirstName As String = String.Empty |
Private _LastName As String = String.Empty |
Private _GuestTypeId As String = String.Empty |
<Telerik.OpenAccess.Transient()> _ 'Turn off as i don't know how to map it |
Private _Addresses As AddressCollection |
<Telerik.OpenAccess.FieldAlias("_Guest_Id")> _ |
Public Property Guest_Id() As String |
Get |
Return _Guest_Id |
End Get |
Set(ByVal value As String) |
_Guest_Id = value |
End Set |
End Property |
<Telerik.OpenAccess.FieldAlias("_FirstName")> _ |
Public Property FirstName() As String |
Get |
Return _FirstName |
End Get |
Set(ByVal value As String) |
_FirstName = value |
End Set |
End Property |
<Telerik.OpenAccess.FieldAlias("_LastName")> _ |
Public Property LastName() As String |
Get |
Return _LastName |
End Get |
Set(ByVal value As String) |
_LastName = value |
End Set |
End Property |
Public Property Addresses() As AddressCollection |
Get |
Return _Addresses |
End Get |
Set(ByVal value As AddressCollection) |
_Addresses = value |
End Set |
End Property |
End Class |
Address Class:
<Telerik.OpenAccess.Persistent(IdentityField:="_Id")> _ |
Public Class Address |
Inherits BusinessBase |
Private _Id As String |
<Telerik.OpenAccess.FieldAlias("_Id")> _ |
Public Property Id() As String |
Get |
Return _Id |
End Get |
Set(ByVal value As String) |
_Id = value |
End Set |
End Property |
... |
Private _Guest_Id As String |
<Telerik.OpenAccess.FieldAlias("_Guest_Id")> _ |
Public Property Guest_Id() As String |
Get |
Return _Guest_Id |
End Get |
Set(ByVal value As String) |
_Guest_Id = value |
End Set |
End Property |
End Class |
AddressCollection Class:
Public Class AddressCollection |
Inherits BusinessCollectionBase(Of Address) |
End Class |