From: Andrei A. (JIRA) <nh...@gm...> - 2011-05-11 11:01:04
|
[ http://216.121.112.228/browse/NH-2422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21049#action_21049 ] Andrei Alecu commented on NH-2422: ---------------------------------- Also see NH-2690 which I believe is related as the cast to QueryableBase<T> results in a different error that occurs under other circumstances. > ToFuture throws NotSupportedException on IQueryable if Fetch is used. > --------------------------------------------------------------------- > > Key: NH-2422 > URL: http://216.121.112.228/browse/NH-2422 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.0.0.CR1 > Reporter: Michael Hart > Priority: Major > > If a Fetch call is added to an NHibernate LINQ query, a NotSupportedException is thrown as the type is no longer an NhQueryable but rather an NhFetchRequest - however, both types extend QueryableBase. > ie, this works: > var result = ses.Query<Child>() > .ToFuture(); > But this throws a NotSupportedException: > var result = ses.Query<Child>() > .Fetch(x => x.Parent) > .ToFuture(); > This makes the ToFuture and ToFutureValue methods of limited use in a production system where eager fetching is necessary. > It also reduces the flexibility to modify queries from being lazy loading (or whatever the default is), to adding eager loading later. If an application has been written using futures and lazy loading, then it is non-trivial to add eager fetching as any futures semantics and logic must also be rewritten. > I believe ToFuture should be modified to test and cast the query as a QueryableBase instead of an NhQueryable. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |