Based on the 4.4 manual, I would expect the following to work:

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
    Dim gigrequests As IEnumerable(Of GigRequest) =
        Client.GigRequests.
            OrderBy(Function(gig) gig.EventDate).
            Prefetch(Function(gig) gig.Leads.
                Prefetch(Function(lead) lead.Performer))

    For Each gig As GigRequest In gigrequests
        ' ...
    Next
End Sub

But I receive a NotSupportedException with the following stack trace:

[NotSupportedException: Only persistented property access, calls of Prefetch method or anonymous type constructors are supported, but found 'Convert(gig.Leads)' expression.]
   Xtensive.Orm.Internals.Prefetch.NodeParser.Visit(Expression e) +209
   Xtensive.Orm.Internals.Prefetch.NodeParser.VisitMethodCall(MethodCallExpression e) +192
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) +428
   Xtensive.Orm.Internals.Prefetch.NodeParser.Visit(Expression e) +161
   Xtensive.Orm.Internals.Prefetch.NodeParser.Parse(DomainModel model, Expression`1 expression) +131
   Xtensive.Orm.Internals.Prefetch.PrefetchFacade`1.RegisterPath(Expression`1 expression) +69
   Xtensive.Orm.PrefetchExtensions.Prefetch(IQueryable`1 source, Expression`1 expression) +199
   client_events.Page_Init(Object sender, EventArgs e) in C:\inetpub.omega\wwwroot\client\events.aspx.vb:11
   System.Web.UI.Control.OnInit(EventArgs e) +91
   System.Web.UI.Page.OnInit(EventArgs e) +12
   System.Web.UI.Control.InitRecursive(Control namingContainer) +140
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +480

Client, GigRequest, Lead and Performer are entities. Lead acts as a ternary table between requests and performers, with a foreign key to each. GigRequest.Leads is an EntitySet. The goal is to load all of the graph Client -> GigRequests -> Leads -> Performer.

The error is encountered in both 4.4 and 4.5-beta4 (7725). DataObjects is being used here with a legacy database, so the classes are on the messy side, but I can post snippets if requested.

I am open to work-arounds and happy to provide more information. Please advise.

asked Aug 31 '11 at 13:11

GigMastersTech's gravatar image

GigMastersTech
27111115

Hello sobelk,

thank for reporting the bug, we will fix it and notify you when is done.

(Sep 01 '11 at 04:05) Dmitri Maximov Dmitri%20Maximov's gravatar image

One Answer:

The issue is fixed in revision 7750, the nightly build will be published shortly.

answered Sep 23 '11 at 08:37

Dmitri%20Maximov's gravatar image

Dmitri Maximov
22111211

The nightly build is available on the website. You need to take revision 7790 or later.

(Oct 03 '11 at 08:19) Dmitri Maximov Dmitri%20Maximov's gravatar image
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

powered by OSQA