Back to Implementing the CollectionImports System.Drawing
Imports System.IO
Public Class ProductImagesCollection
Inherits EPS.Business.BusinessObjects.EntitySubItemCollection
Public Sub New(ByVal parentEntity As IBusinessEntity)
MyBase.New(parentEntity)
End Sub
Protected Overrides Sub Configure()
Me.PrimaryKeyField = "image_pk"
Me.ForeignKeyField = "product_fk"
Me.ParentTableName = "products"
Me.ParentTablePrimaryKeyField = "product_pk"
End Sub
Public Overrides Function GetItemObject() As EPS.Business.BusinessObjects.EntitySubItemCollectionItem
Return New CType(ProductImageEntity, EntitySubItemCollectionItem?)
End Function
Default Public Shadows ReadOnly Property Item(ByVal index As Integer) As ProductImageEntity
Get
Return CType(Me.GetItemByIndex(index), ProductImageEntity)
End Get
End Property
Public Overloads Sub Add(ByVal label As String, ByVal image As Bitmap)
Dim entImage As ProductImageEntity = CType(Me.AddNewRow(), ProductImageEntity)
entImage.Label = label
entImage.Image = image
End Sub
End Class
Back to Implementing the Collection