using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using Castle.ActiveRecord; namespace ProductModelActiveRecord { [ActiveRecord(Table="SimpleProducts")] public class Product { private IList _RelatedProducts; private IList _ProductGroups; public Product() { _RelatedProducts = new List(); _ProductGroups = new List(); } [PrimaryKey(Column="ProductID", Generator=Castle.ActiveRecord.PrimaryKeyType.UuidHex)] public virtual string ID { get; private set; } [Property(NotNull=true, Length=50, Column="Title")] public virtual string Title {get; set; } [Property(Length=300, NotNull=false, Column="ImagePath")] public virtual string ImagePath { get; set; } [Property(NotNull = false, Length = 500, Column="Description")] public virtual string Description { get; set; } [HasAndBelongsToMany(Table="RelatedProductsLookup", ColumnKey="ProductID", ColumnRef="RelatedProductID")] public virtual IList RelatedProducts { get { return _RelatedProducts; } set { _RelatedProducts = value; } } [HasAndBelongsToMany(Table="ProductsProductGroupsLookup", ColumnKey="ProductID", ColumnRef="ProductGroupID")] public virtual IList ProductGroups { get { return _ProductGroups; } set { _ProductGroups = value; } } } }