Strange lazy load problem
- by JooLio
public class QuickQuoteTemplate
{
...
public virtual IList<QuickQuoteTemplateItem> InnerItems
{
get;
set;
}
...
}
public class QuickQuoteTemplateItem
{
...
public virtual IList<QuickQuoteTemplateItem> InnerItems
{
get;
set;
}
...
}
<class name="QuickQuoteTemplate" table="SA_QUICK_QUOTE_TEMPLATE">
...
<bag name="InnerItems" lazy="false" inverse="true" cascade="delete" >
<key column="PARENT_QQ_TEMPLATE_ID" ></key>
<one-to-many class="QuickQuoteTemplateItem" />
</bag>
...
</class>
<class name="QuickQuoteTemplateItem" table="SA_QUICK_QUOTE_TEMPLATE_ITEMS">
...
<bag name="InnerItems" lazy="false" inverse="false" cascade="delete">
<key column="PARENT_ITEM_ID" />
<one-to-many class="QuickQuoteTemplateItem" />
</bag>
...
</class>
InnerItems collections is set as no lazy, but after disposing the ISession instance, quickQuote.InnerItems is crying "failed to lazily initialize a collection, no session or session was closed".
I've even tried to call InnerItems before the session is closed by myself. It successfully retrieves, but after disposing of the session it becomes not initialized.