AR has the problem that if you don't use SessionScopes, it can't use lazy
loading at all. Therefore lazy loading was disabled by default. AFAIR you
have to set lazy="true" in your AR config to enable lazy loading of
many-to-one relations.

-Markus

2009/8/11 William Chang <diehardb...@gmail.com>

>
> Here is my model setup:
> I have two entities, "List" and "ListItem". The "List" class is the
> parent with the property "public virtual List listParent {get;set;}"
> to create the hierarchy. The "ListItem" class is the child or
> children, containing items for the list.
>
> The problem is when I do a Find() on an item from the "ListItem"
> class, it pulls everything from above. The "List", the parent, gets
> joined which is okay, but then it pulls the grand parent list, and so
> on. How do I prevent or stop NHibernate/Activerecord from parsing up
> the tree (not needed, hurting performance)?
>
> I tried using "Lazy" in my "List" class:
> [ActiveRecord(Table = "Lists")]
> public class List : ActiveRecordBase<List> {
>    [BelongsTo("listParentId", Lazy = FetchWhen.OnInvoke)]
>    public virtual List listParent {get;set;}
> }
>
> And, I tried using "Lazy" in my "ListItem" class:
> [ActiveRecord(Table = "ListItems")]
> public class ListItem : ActiveRecordBase<ListItem> {
>    [BelongsTo("itemListId", Lazy = FetchWhen.OnInvoke)]
>    public virtual List itemList {get;set;}
> }
>
> Please help?
>
> Specs:
> NHibernate 2.1.0GA
> Castle ActiveRecord 2.0
> ASP.NET 3.5 SP1 MVC 1.0
>
> Thanks,
> William Chang
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to castle-project-users@googlegroups.com
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to