MethodInfo method;
                    ParameterInfo[] parameters;
                    ReflectionHelper.FindMethod(typeof(Query), "All", new[] { type.UnderlyingType }, new Type[0], out method, out parameters); // Find Generic All() method
                    var qu = method.Invoke(null, null) as IQueryable; // Query works here, at least i can see every object in foreach
                    foreach (Entity obj in qu)
                        var refs = obj.FindReferencingObjects().ToList(); // Exception here

I got this: > "Query task is not executed yet."

at Xtensive.Storage.Internals.QueryTask.GetEnumerator() at Xtensive.Storage.Internals.RecordSetReader.<read>d0.MoveNext() at Xtensive.Storage.RecordSetExtensions.<toentities>da.MoveNext() at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at Xtensive.Storage.ReferenceFinder.<GetReferencesTo>d__0.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at Web.Tester.DomainBuilder.Build() in D:\Home\Docs\Visual Studio 2008\Projects\Platform\Web.Tester\DomainBuilder.cs:line 57

If I do smth like

foreach (var qu in Query.All<User.MlUserRole>())
                    var refs = qu.FindReferencingObjects().ToList();

The method works ok

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Apr 01 '10 at 13:48

xumix's gravatar image


One Answer:

Try to replace qu to qu.ToList() in foreach - possibly, there is some issue with future queries (reference finding framework uses internal objects related to future queries directly).

We'll study the issue.

answered Apr 01 '10 at 16:53

Alex%20Yakunin's gravatar image

Alex Yakunin

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview


Once you sign in you will be able to subscribe for any updates here



Asked: Apr 01 '10 at 13:48

Seen: 2,467 times

Last updated: Apr 01 '10 at 13:48

powered by OSQA