On Sun, Sep 13, 2009 at 9:03 AM, 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 > > Gauthier I used the 'CompositeKey' approach and as far as i am seeing, the schema was created as expected, however i still need to create, update and delete some records. Thanks a lot for your help *note*: All those that are in the same problem that i was, please feel free to drop me an email an i will send you the code --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
