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
27●11●11●15
Hello sobelk,
thank for reporting the bug, we will fix it and notify you when is done.