you can try testing with
NHibernateUtil.IsInitialized(laizy property);
On May 20, 12:12 pm,
belvasis...@googlemail.com wrote:
> I don't think so beacuse in the first case ("proxy") => one query is
> executed
> in the second case ("no-proxy") => two queries are executed immediately
>
> In the first case, the second query (for the Script property) is only
> executed, if i use the VS watch window
> or something. This is the expected behaviour. But i thought this should be
> the same if i use "no-proxy"
>
> Am schrieb Mohamed Meligy <
eng.mel...@gmail.com>:
>
>
>
>
>
>
>
> > The query for the Script is then executed if i look at the property in
> > the VS watch window.
> > Maybe this is the reason? To get the property value, even in Visual
> > Studio watch window, the property getter is executed.
> > Mohamed Meligy
> > Readify | Senior Developer
> > M:
+61 451 835006 | W:
readify.net
> > On Fri, May 20, 2011 at 7:34 PM,
belvasis...@googlemail.com> wrote:
> > @mohamed
> > to test this, i simply do
> > Marker pTM = Session.Get(10824);
> > and then check the sql output to the console. Using "proxy" only one
> > query is executed:
> > NHibernate: SELECT marker0_.MARKER_ID as REPORTS1_282_2_...
> > The query for the Script is then executed if i look at the property in
> > the VS watch window.
> > Using "no-proxy" the call to Get shows two executed queries, one for the
> > Marker itself and the second for the Script:
> > NHibernate: SELECT marker0_.MARKER_ID as REPORTS1_282_2_...
> > NHibernate: SELECT script0_.SCRIPT_ID as T1_264_3_, script0_.SC_DESCR ...
> > One guess was that the ID is the problem since this is a property and it
> > will be touched to create the temp
> > instance. So i changed it to access="field.pascalcase-m-underscore" but
> > it did'nt solve the problem.
> > Am schrieb Mohamed Meligy
eng.mel...@gmail.com>:
> > > Ramon, this is not eager loading.
>
> > > Quoting from the mentioned post:
>
> > > When lazy is set to no-proxy, the following things happen:The
> > association is still lazy loaded (note that in older versions of
> > NHibernate, setting it to no-proxy would trigger eager loading, this is
> > no longer the case).
>
> > > The first time that you access the property the value will be loaded
> > from the database, and the actual type will be returned.
>
> > > @belvasis,
> > > How are checking this? Note that maybe even looking up the value in
> > debugger or Visual Studio Watch window triggers this. Are you sure your
> > code is not touching the property in any way?
>
> > > Can you isolate it and paste it in a letter message?
>
> > > Thanks a lot.
>
> > > Regards,
>
> > > Mohamed Meligy
> > > Readify | Senior Developer
>
> > > M:
+61 451 835006 | W:
readify.net
>
> > > On Fri, May 20, 2011 at 5:08 PM, Ramon Smits
ramon.sm...@gmail.com>