Ok, this is stupid. I was in debug mode and looked at the variables within 
the session (needed more sleep I guess). Fixed it now with .ToFuture, not 
sure how I like it, but it works.

Op donderdag 13 juni 2013 08:14:52 UTC+2 schreef Patrick Sannes het 
volgende:
>
> There is a risk that I double post this message, though, I thought my user 
> was confirmed and I cannot find my original message back. I'm very sorry if 
> this is the case.
>
> I'm performing a query on my database structure. The structure looks like 
> this:
>
> Country 1..M CountryLocales
> 1
> ..
> M
> Cities 1..M CityLocales
>
> So a country has multiple locales and multiple cities. A city also has 
> multiple locales. With the query I try to retrieve a city with it's 
> locales, its country and the country locales. I did this with this query:
>
>  City city = Session.Query<City>()
>                           .Where(x => x.Id == id)
>                           .Fetch(c => c.Country)
>                           .ThenFetch(c => c.CountryLocales)
>                           .FetchMany(x => x.CityLocales)
>                           .AsEnumerable()
>                           .FirstOrDefault();
>
> This query has a problem. All the locale objects are fetched twice and 
> thus double.
>
> By Accident I fiddled a bit with the query and executed it. To my surprice 
> it game me the correct result. This is the query I ran:
>
>  City city = Session.Query<City>()
>                           .Where(x => x.Id == id)
>                           .Fetch(c => c.Country)
>                           .FetchMany(x => x.CityLocales)
>                           .AsEnumerable()
>                           .FirstOrDefault();
>
> So I left out the ThenFetch, I expected it to load everything without the 
> Country locales, but instead it loaded what I wanted including the country 
> locales. I'm now quite unsure what is going on here. Am I missing something?
>
> Patrick
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to