Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> PreFetch on Linq query
 

Pages: 1
LLBLGen Pro Runtime Framework
PreFetch on Linq query
Page:1/1 

  Print all messages in this thread  
Poster Message
JSobell
User



Location:

Joined on:
07-Jan-2006 06:44:46
Posted:
89 posts
# Posted on: 15-Jan-2018 06:31:06. Goto attachments  
Using an Adapter and following the doco example, what am I doing wrong in the attached expression?

Code:

            var qf = new QueryFactory();
            var q = db.UserStream
                    .Where(u => (!u.Processed))
                    .WithPath(UserStreamEntity.PrefetchPathStreamrow.WithSubPath(StreamrowEntity.PrefetchPathStream))
  Top
JSobell
User



Location:

Joined on:
07-Jan-2006 06:44:46
Posted:
89 posts
# Posted on: 15-Jan-2018 08:16:02.  
Well the following format works, but is different to the example in the doco:
Code:

    var q = db.UserStream
        .WithPath(p => p.Prefetch<StreamrowEntity>(x => x.Streamrow).SubPath(op => op.Prefetch<StreamEntity>(sr => sr.Stream)))
        .Where(u => (!u.Processed))
        .Where(u => u.Streamrow.Stream.ProjectId == _scriptUserContext.ProjectContext.ProjectId
                            && (u.Streamrow.Stream.Name == filter || filter == null));


  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8110 posts
# Posted on: 15-Jan-2018 08:17:12.  
In the picture, What is variable db of type Database?
Why you didn't use qf?
Code:
var q = qf.UserStream
...


Are you using Linq or QuerySpec for fetching the query?

What is the LLBLGen version and runtime library version that you are using? ( http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7725 )
David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37880 posts
# Posted on: 15-Jan-2018 10:26:39.  
yes, 'db' is unknown what it is and indeed the qf isn't used so I think linq and queryspec are mixed here.

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
JSobell
User



Location:

Joined on:
07-Jan-2006 06:44:46
Posted:
89 posts
# Posted on: 15-Jan-2018 12:03:17.  
Otis wrote:
yes, 'db' is unknown what it is and indeed the qf isn't used so I think linq and queryspec are mixed here.


Ah, yes, I must have been reading the QuerySpec stuff, while in this case db is a Linq metadata object. The wide range of options for querying data makes it very tricky to work out how to perform non-trivial operations like this.
`qf` was introduced as a test after I crashed and burned trying to use PrefetchPathStreamrow in a Linq operation, so presumably that property serves no purpose in a Linq based operation chain?
  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37880 posts
# Posted on: 15-Jan-2018 16:50:18.  
Indeed, queryfactory is used for queryspec, and linq uses LinqMetaData. If you write a Linq query, you don't need queryfactory and if you write a queryspec query you don't need LinqMetaData.

Linq has different extension methods for prefetchpaths than queryspec.


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.