Can we do lazy loading case by case basis?
I have a Allocation and Model class
public class Allocation : EntityBase
{
public virtual int Id { get; set; }
public virtual string AllocationName { get; set; }
public virtual string AllocationDescription { get; set; }
public virtual IList<Model> Models { get; set; }
public virtual string Status { get; set; }
public virtual DateTime LastUpdated { get; set; }
}
public class Model : EntityBase
{
public virtual int Id { get; set; }
public virtual string ModelName { get; set; }
public virtual string ModelDescription { get; set; }
}
Allocation class contains IList of Models.
I have configured the Models to be lazy loaded.
Here is the mapping file
<?xml version="1.0" encoding="utf-8" ?>
<!-- NHibernate mapping file between Allocation table and Allocation
class-->
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class table="Allocation"
name="Com.Honda.Auto.NGM.Entities.Allocation,Com.Honda.Auto.NGM.Entities"
>
<id name="Id" column="Id">
<generator class="identity"></generator>
</id>
<timestamp column="LastUpdateTimestamp" name="LastUpdateTimestamp"
unsaved-value="null" generated="never"></timestamp>
<property column="LastUpdateUserId" name="LastUpdateUserId"></
property>
<property column="CreateTimestamp" name="CreateTimestamp"></
property>
<property column="CreateUserId" name="CreateUserId"></property>
<property name="AllocationName" column="Name"></property>
<property name="AllocationDescription" column="Description" ></
property>
<!--<property name="Status" column="Status" ></property>-->
<bag name="Models" table="ModelAllocation" lazy="true"
fetch="join">
<key column="AllocationId"></key>
<many-to-many
class="Com.Honda.Auto.NGM.Entities.Model,Com.Honda.Auto.NGM.Entities"
column="ModelId" fetch="join" ></many-to-many>
</bag>
</class>
</hibernate-mapping>
Can i change the lazy loading behavior case by case basis without
rebuilding the session factory.
The behavior i am expecting is in some cases when i get an Allocation
it should give me Models as well.
but in other case it should not load models.
Is there any way to achieve this?
Thanks,
Sravan
--
You received this message because you are subscribed to the Google Groups
"nhusers" 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/nhusers?hl=en.