The other way is with a product Id column (identity or guid) which is hidden from the user, which would simplify many things. This would mean that other tables that reference the product table would only need a single column that foreign keys back to product.
On Sun, Sep 13, 2009 at 5:03 PM, Gauthier Segay <[email protected]>wrote: > > you could create a CompositeKey (requires a serializable class with > GetHashCode and Equals overrided) > > this key will contains theses key properties > - string Code > - int SupplierKey > > and set the actual BelongsTo relation with Update=false, Insert=false > > On Sep 13, 12:08 am, Mark Borg <[email protected]> wrote: > > Hi guys, > > > > I have the following situation > > > > <code> > > > > [ActiveRecord("pr_product", Lazy = true)] > > public class Product : ActiveRecordValidationBase<Product>{ > > > > // Stock code > > [Property()] > > public virtual string stockCode { get; set; } > > > > // Supplier > > [BelongsTo("supplierId")] > > public virtual Supplier user { get; set; } > > > > } > > > > [ActiveRecord("usr_supplier", Lazy = true)] > > public class Supplier : BaseUser<Supplier> { > > > > // PRODUCTS > > [HasMany(typeof(Product), > > Lazy = true, > > Fetch = FetchEnum.Select, > > Inverse = false, RelationType = > > RelationType.Bag, Cascade = ManyRelationCascadeEnum.All)] > > public virtual IList<Product> products { get; set; } > > > > } > > </code> > > > > What i would like to do, is to create a composite key between STOCK > > CODE and the SUPPLIER in the PRODUCT entity. This is required in order > > to allow the same stock code to exist in more than one SUPPLIER but > > unique in the same SUPPLIER. > > > > Any help would be greatly appreciated, > > thanks guys > > > -- Jono --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
