﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Martin commented on NHibernate new feature: Lazy Properties</title><description>btw. i just want to add after having tested it some more, that the proxy works fine (i am able to call the methods on the object) if there is no lazy properties set on the object/proxy.
  
  
But when a property is set to be lazyloaded, it is not possible to call any methods on the proxy / object being generated.
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment37</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment37</guid><pubDate>Sat, 27 Mar 2010 17:31:26 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate new feature: Lazy Properties</title><description>Martin,
  
No, it is not a known issue, can you create a JIRA issue for this?
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment36</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment36</guid><pubDate>Sat, 27 Mar 2010 16:12:39 GMT</pubDate></item><item><title>Martin commented on NHibernate new feature: Lazy Properties</title><description>Hello again,
  
  
This is really is a nice feature.
  
Lazyloading a component actually also works with the latest code.
  
  
But there is a really big show stopper.
  
If i query an object an Castle.Proxies.MyObjectProxy is returned, and it is not possible to call any methods on the MyObject object.
  
  
The method is never hit.
  
It is like it is overriding the methods and never calls the base method.
  
  
Is this a know issue ?
  
  
Martin
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment35</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment35</guid><pubDate>Sat, 27 Mar 2010 15:43:04 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate new feature: Lazy Properties</title><description>Rasmus,
  
That isn't what Enumerable does, Enumerable is useful if you expect most of your results to reside in the 2nd level cache
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment34</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment34</guid><pubDate>Wed, 03 Mar 2010 12:42:12 GMT</pubDate></item><item><title>Rasmus commented on NHibernate new feature: Lazy Properties</title><description>"This is very useful for binary data. However, I'm wondering if there is a way that NHibernate can stream the data? Using something like SqlDataReader for sequential access to varbinaries, rather than pulling all the data at once?"
  
  
Wouldnt IQuery.Enumerable combined with Session.Evict let you do something like this. The manual 14.5 says:
  
  
"Whenever you pass an object to Save(), Update() or SaveOrUpdate() and whenever you retrieve an object using Load(), Find(), Enumerable(), or Filter(), that object is added to the internal cache of the ISession. When Flush() is subsequently called, the state of that object will be synchronized with the database. If you do not want this synchronization to occur or if you are processing a huge number of objects and need to manage memory efficiently, the Evict() method may be used to remove the object and its collections from the cache.
  
  
IEnumerable cats = sess.Enumerable("from Eg.Cat as cat"); //a huge result set
  
foreach( Cat cat in cats )
  
{
  
    DoSomethingWithACat(cat);
  
    sess.Evict(cat);
  
}
  
"
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment33</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment33</guid><pubDate>Wed, 03 Mar 2010 07:33:00 GMT</pubDate></item><item><title>Martin commented on NHibernate new feature: Lazy Properties</title><description>Thanks, i have just opened one.
  
  
I filed it under Bug, but it might actually be a New Feature depending on if it should be possible.
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment32</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment32</guid><pubDate>Mon, 01 Mar 2010 23:36:54 GMT</pubDate></item><item><title>InezPage34 commented on NHibernate new feature: Lazy Properties</title><description>I had a dream to start my own business, nevertheless I did not have enough amount of cash to do this. Thank heaven my friend recommended to use the 
[loan](http://lowest-rate-loans.com). Hence I used the college loan and made real my old dream. 
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment31</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment31</guid><pubDate>Mon, 01 Mar 2010 22:26:10 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate new feature: Lazy Properties</title><description>Please open a JIRA issue
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment30</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment30</guid><pubDate>Mon, 01 Mar 2010 21:53:46 GMT</pubDate></item><item><title>Martin commented on NHibernate new feature: Lazy Properties</title><description>Thanks for the quick reply.
  
It is possible to set lazy=true but it isnt working, that is why i am wondering if it actually should work.
  
  
:)
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment29</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment29</guid><pubDate>Mon, 01 Mar 2010 21:50:43 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate new feature: Lazy Properties</title><description>Martin,
  
I don't _think_, but I haven't checked.
  
You can try :-)
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment28</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment28</guid><pubDate>Mon, 01 Mar 2010 19:58:41 GMT</pubDate></item><item><title>Martin commented on NHibernate new feature: Lazy Properties</title><description>Ayende: Is it possible to mark a Component to be lazyload ?
  
  
So if any of the properties in the component is accessed all properties in the component is loaded ?
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment27</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment27</guid><pubDate>Mon, 01 Mar 2010 14:54:14 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate new feature: Lazy Properties</title><description>lpodolak,
  
Separate them to a different table, that is my suggestion
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment26</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment26</guid><pubDate>Thu, 28 Jan 2010 20:02:40 GMT</pubDate></item><item><title>lpodolak commented on NHibernate new feature: Lazy Properties</title><description>"As usual, be cautious in over using it.". 
  
  
I can only think of this as a way to prevent some blobs  and clobs fetched when we don't need them. But doesn't it lead to the point that we should separate blob and clobs in our storage (as keeping them in separate tables)? Keeping the Post.Image together as an business entity would make sense due to consistency with customer's language, However in database, it wouldn't be that necessare to keep image in the Posts table.
  
  
Which approach do you recommend and why? 
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment25</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment25</guid><pubDate>Thu, 28 Jan 2010 19:52:00 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate new feature: Lazy Properties</title><description>Ssidhu,
  
No, if you want a stream, you need to do provide a Stream property and a IUserType implementation
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment24</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment24</guid><pubDate>Thu, 28 Jan 2010 16:36:20 GMT</pubDate></item><item><title>SS commented on NHibernate new feature: Lazy Properties</title><description>This is very useful for binary data.  However, I'm wondering if there is a way that NHibernate can stream the data?  Using something like SqlDataReader for sequential access to varbinaries, rather than pulling all the data at once?
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment23</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment23</guid><pubDate>Thu, 28 Jan 2010 16:08:16 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate new feature: Lazy Properties</title><description>Configurator,
  
No, you can't. To be rather more exact, you won't know when NH is doing it and when some other code is.
  
Your code would work, however.
  
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment22</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment22</guid><pubDate>Thu, 28 Jan 2010 15:41:15 GMT</pubDate></item><item><title>configurator commented on NHibernate new feature: Lazy Properties</title><description>I like this idea.
  
  
Can I use the property setter as a way to know when the lazy property is fetched? Can I assume it will only happen once (except when I set the property myself)?
  
  
public string Text {
  
    get { return text; }
  
    set {
  
        text = value;
  
        DoLongOperationToPrepareTextForDisplay();
  
    }
  
}
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment21</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment21</guid><pubDate>Thu, 28 Jan 2010 15:34:50 GMT</pubDate></item><item><title>Thilak Nathen commented on NHibernate new feature: Lazy Properties</title><description>Something still smells about the whole deal.
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment20</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment20</guid><pubDate>Thu, 28 Jan 2010 09:49:30 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate new feature: Lazy Properties</title><description>Edin,
  
Two reasons:
  
a) it isn't implemented in hibernate
  
b) having two stage load is usually enough, while you can make arguments that it would be nice to have multiple fetch groups, the problem is that you then start making things so much harder on a lot of levels.
  
Just deciding what should go where would be hard enough, then you have the complexity of multiple fetch groups in a single entity, the possibility of loading an entity goes from a select or to to M selects, where M is the number of fetch groups.
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment19</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment19</guid><pubDate>Wed, 27 Jan 2010 23:13:38 GMT</pubDate></item><item><title>Edin commented on NHibernate new feature: Lazy Properties</title><description>Very nice feature indeed. But, in case of multiple lazy properties, why isn't it possible to load only one lazy property when accessed ? I do however agree on advice of not overusing this feature. 
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment18</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment18</guid><pubDate>Wed, 27 Jan 2010 21:56:14 GMT</pubDate></item><item><title>Nasty Nitpicker commented on NHibernate new feature: Lazy Properties</title><description>I see, playing Humpty Dumpty?
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment17</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment17</guid><pubDate>Wed, 27 Jan 2010 19:22:44 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate new feature: Lazy Properties</title><description>Nitpicker,
  
I call it select n+1.
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment16</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment16</guid><pubDate>Wed, 27 Jan 2010 19:16:53 GMT</pubDate></item><item><title>Nasty Nitpicker commented on NHibernate new feature: Lazy Properties</title><description>Just a small nitpick as I see this in your posts all the time: it's not "SELECT N+1", that's nonsense. The right expression is "the N+1 SELECTs problem".
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment15</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment15</guid><pubDate>Wed, 27 Jan 2010 19:15:15 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate new feature: Lazy Properties</title><description>Ivos,
  
No, not at the moment.
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment14</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment14</guid><pubDate>Wed, 27 Jan 2010 14:33:14 GMT</pubDate></item><item><title>ivos commented on NHibernate new feature: Lazy Properties</title><description>Really nice and expected feature!
  
Could batch be configured for lazy properties?
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment13</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment13</guid><pubDate>Wed, 27 Jan 2010 14:20:23 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate new feature: Lazy Properties</title><description>David,
  
No, it _will_ work, but you must ensure that you never actually access the field directly.
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment12</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment12</guid><pubDate>Wed, 27 Jan 2010 14:04:27 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate new feature: Lazy Properties</title><description>Thilak,
  
The problem is that it violates one of POCOness, it you need to use NHibernate's types to handle that.
  
The entity should be aware of its loaded status, either.
  
  
Having auto props means that this is basically transparent, and my solution for your dillema would be
  
  
protected virtual string TextInternal {get;set;}
  
  
public virtual string Text { get { return Text; } set { Text = value; } 
  
  
You can certainly extend the support for this in NH, of course, if you really care that much about 
  
  
Bytecode weaving means that you need a post compile step, and that it something we would like to avoid
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment11</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment11</guid><pubDate>Wed, 27 Jan 2010 14:03:50 GMT</pubDate></item><item><title>David commented on NHibernate new feature: Lazy Properties</title><description>"What this means is that if you mark a property as lazy, it must be a virtual automatic property."
  
  
Does that mean this won't work for VB code except in VS2010?
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment10</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment10</guid><pubDate>Wed, 27 Jan 2010 14:01:12 GMT</pubDate></item><item><title>Thilak Nathen commented on NHibernate new feature: Lazy Properties</title><description>I get the interception dilemma... but what's wrong with
  
  
private IMyLazyLoadedProperty
&lt;string _text;
  
  
instead of
  
  
private string _text;
  
  
The former could be proxied for lazy loading perhaps? Or perhaps use the latter, CLR string type, but improve on IUserType to support lazy loading? (I'm not sure if we can already do this with a custom NH type).
  
  
Btw, how do we do bytecode weaving in NH? And why would that be bad?
&gt;</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment9</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment9</guid><pubDate>Wed, 27 Jan 2010 13:56:36 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate new feature: Lazy Properties</title><description>Thilak,
  
The reason for that is quite simple, we need to intercept the access.
  
The other option is bytecode weaving, and we don't want to do this by default
</description><link>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment8</link><guid>http://ayende.com/4377/nhibernate-new-feature-lazy-properties#comment8</guid><pubDate>Wed, 27 Jan 2010 13:38:00 GMT</pubDate></item></channel></rss>