C# Code to Implement a Child Collection

Back to Implementing the Collection
using System.Drawing; using System.IO; public class ProductImagesCollection : EPS.Business.BusinessObjects.EntitySubItemCollection public ProductImagesCollection (IBusinessEntity parentEntity): base(parentEntity) { } protected override void Configure() { this.PrimaryKeyField = "image_pk"; this.ForeignKeyField = "product_fk"; this.ParentTableName = "products"; this.ParentTablePrimaryKeyField = "product_pk"; } public override EPS.Business.BusinessObjects.EntitySubItemCollectionItem GetItemObject() { return (EntitySubItemCollectionItem)(new ProductImageEntity()); } public new ProductImageEntity this[int index] { get { return (ProductImageEntity)this.GetItemByIndex(index); } } // Add this method only if needed... public void Add(string label, Bitmap image) { ProductImageEntity entImage = (ProductImageEntity)this.AddNewRow(); entImage.Label = label; entImage.Image = image; } }

Back to Implementing the Collection


Last Updated: 8/10/2006