After thinking about this, I realize that it has to load the key entities. 
 Because it's a dictionary, GetHashCode() will be used upon the keys.  And 
good GetHashCode() implementations should consider the values of the 
object.  Thus, it must be loaded.

I think I'll forego the dictionary and just use a list, internalizing the 
look-ups in methods.

On Monday, April 1, 2013 4:09:33 PM UTC-4, Trinition wrote:
>
> I have a class, Settings, which includes an 
> IDictionary<Area,AreaSettings>where all three types are entities.  Thus, my 
> mapping looks like:
>
> <class class="Settings" ...>
> <map ...>
> <index-many-to-many ... class="...Area..." ... />
> <one-to-many class="...AreaSettings..." ... />
> </map>
> </class>
> <class class="...AreaSettings...">
> ...
> <many-to-one name="Settings" column="SettingsID" ... />
> </class>
>
> Later in my code where I step on the collection to loop over it, there's 
> one query for the collection's contents, and then N queries for each of the 
> N children getting the Area:
>
> select ... from AreaSetings WHERE SettingsID=4 ...
> select ... from Area WHERE AreaID=1...
> select ... from Area WHERE AreaID=3...
> select ... from Area WHERE AreaID=4...
> select ... from Area WHERE AreaID=6...
> select ... from Area WHERE AreaID=7...
> select ... from Area WHERE AreaID=8...
> ...
>
> I don't need the Areas proactively loaded as I'm looping over the 
> collection.  If that's unavoidable, then I'd rather see them fetched in 
> batches.  I've read and thought I understood 'lazy', 'batch', 'fetch' but 
> the various combinations I've tried haven't changed anything.  I'm guessing 
> most of those affect the *values* in the IDictionary, not the *keys*.
>
> What do I need to do to either (a) lazy-load the keys of this IDictionary 
> or (b) more efficiently load the keys?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to