Hi,
i just try to optimize my app a little and there are some things i don't
understand.
Usually i mark all <many-to-one> associations with fetch="join", so all
associations
are loaded in one step, if i use Session.Get(). Using Linq, this is ignored
and i
have to use Session.Query<>().Fetch( t => t.Category ) etc. All associations
not included in the Fetch() call will be loaded separatly step by step,
when calling
ToList(). So far i understand the behaviour. There are some associations
i will only need in rare cases. So i thought it would be nice to load them
only when
accessed for the first time.
As far as i understood lazy="proxy|no-proxy" will do this. According to this
http://ayende.com/blog/4378/nhibernate-new-feature-no-proxy-associations
an association marked as lazy=no-proxy" will only be loaded if accessed for
the first time but will be created with the ID property set. If i use
<many-to-one name="TMScript" column="SCRIPT_ID"
class="Domain.Base.Scripting.Script" lazy="no-proxy"/>
it does nothing but creating a proxy of a Script entity and querying it's
values from the DB in a separate
query.
If i use
<many-to-one name="TMScript" column="SCRIPT_ID"
class="Domain.Base.Scripting.Script" lazy="proxy"/>
it works they way i wanted it.
So, can anyone please explain what the difference betwen lazy="proxy" and
lazy ="no-proxy" is?
Thanks
--
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.