Please describe your problem. Here are some things that sprung into my eyes:

2010/7/22 MWightman <[email protected]>:

>            Item childItem = new Item("200", "Item 200");
>            childItem.Save();
>
>            Item masterItem = new Item("100", "Item 100");
>            masterItem.Add(childItem, 10);
>            masterItem.Save();
You are using self-referencing here, right?

>     [ActiveRecord]
>    public class Item:Arbase<Item>
>    {
>        [HasMany]
>        public virtual IList<Component>  Components
>        {
>            get { return _l; }
>            set { _l = value; }
>        }
You should add Lazy=true, Inverse=true, Cascade=ManyCascadeEnum.AllDeleteOrphan
Lazy prevents loading the whole tree when only asking for one Item
Cascade automatically saves new Components and deletes those that are
not associated with any Item.
>        public Component Add(Item child,int qty)
>        {
>            Component c=new Component(this,child,qty);
>            this.Components.Add(c);
>            return c;
>        }
Either you must cascade the Components relation or you have to call
c.Save() before adding it to Components.
>
>    }
>
>  [ActiveRecord]
>    public class Component:Arbase<Component>
>    {
>        [Property]
>        public virtual Item Child { get; set; }
Use BelongsTo, Property works only for scalar properties, not for types
>    }

-Markus

-- 
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.

Reply via email to