anybody ?

On 28 apr, 10:54, Remco Ros <[email protected]> wrote:
> When I execute the following query, I get an exception telling me that
> 'feedItemQuery' contains multiple items (so SingleOrDefault doesn't
> work).
> This is expected behaviour when using the Criteria api WITHOUT the
> DistinctRootEntity transformer, but when using linq, I expect to get a
> single root entity (FeedItem, with the property Ads (of ICollection)
> containing all Ads).
>
> Is there a way to tell NHibernate.Linq to use the DistinctRootEntity
> transformer?
>
> My query:
>
> var feedItemQuery = from ad in session.Linq<FeedItem>().Expand("Ads")
>                                    where ad.Id == Id
>                                    select ad;
>
> var feedItem = feedItemQuery.SingleOrDefault(); // This fails !?
>
> The mapping:
>
> <class name="FeedItem" table="FeedItems" proxy="IFeedItem">
>         <id name="Id" type="Guid">
>                 <generator class="guid.comb"></generator>
>         </id>
>  ...
>         <set name="Ads" table="Ads">
>                 <key column="FeedItemId" />
>                 <one-to-many class="Ad" />
>         </set>
> </class>
>
> Thanks in advance,
>
> Remco
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to