From: Kelly S. (JIRA) <nh...@gm...> - 2011-05-12 17:49:10
|
[ http://216.121.112.228/browse/NH-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21063#action_21063 ] Kelly Stuard commented on NH-2690: ---------------------------------- Big thanks to all who touched this. This allows for all sorts of performance improvements. > Linq Select() broken with .ToFuture() > ------------------------------------- > > Key: NH-2690 > URL: http://216.121.112.228/browse/NH-2690 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Assignee: Fabio Maulo > Priority: Major > Fix For: 3.2.0Beta1 > > Attachments: nh2690 nh2422 nh2421.patch, NH2690.zip > > > //Given the following: > var query = > from cat in session.Query<Cat>() > select new > { > Id = cat.Id, > Name = cat.Name, > }; > //This works: > var result1 = query.ToList(); > //But this does not: > var queryResults = query.ToFuture().ToList(); > Exception: > NHibernate.HibernateException was unhandled > Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; > ] > Source=NHibernate > StackTrace: > at NHibernate.Impl.MultiQueryImpl.DoList() > at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() > at NHibernate.Impl.MultiQueryImpl.List() > at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) > at NHibernate.Impl.FutureBatch`2.GetResults() > at NHibernate.Impl.FutureBatch`2.get_Results() > at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) > at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() > at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 > at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 > at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.ArgumentException > Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. > Parameter name: value > Source=mscorlib > ParamName=value > StackTrace: > at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) > at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) > at NHibernate.Impl.MultiQueryImpl.DoList() > InnerException: > This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. > I will attach test cases used to generate this exception, shortly. -- 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 |