Low-level vs. QuerySpec

Posts   
 
    
obzekt
User
Posts: 60
Joined: 29-Apr-2004
# Posted on: 22-Nov-2016 17:24:06   

Hello. We have a relatively large and mature project built on the Self-Servicing model that we are about to migrate to Adapter in order to support multiple databases. We are wondering whether we should keep the low-level API that we're familiar with, or take the opportunity to switch to the more expressive and elegant QuerySpec or Linq. Since the latter APIs are built on top of low-level, we're afraid that there may be an overhead at runtime. What do you guys think?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 23-Nov-2016 10:51:08   

Linq has more overhead than queryspec, which overhead is minimal. You don't have to switch to a different query system however if you don't want to, the low level queries will keep on working with newer versions. Not having to migrate these could save you a lot of time. If you want to migrate to a newer query system, in general use what fits you best, where QuerySpec is recommended as it's the most flexible and closest to SQL.

To see the overhead of the query systems, see the non-change tracking individual fetch benchmarks of the different APIs in our benchmarks here: https://github.com/FransBouma/RawDataAccessBencher/blob/master/Results/2016-11-22.txt

There you can see that queryspec has a small overhead compared to raw SQL, but not as much as Linq. You can mix all query APIs in your application, you don't have to stick to one. If one query is easier formulated in Linq, and the other in queryspec, use both simple_smile

Frans Bouma | Lead developer LLBLGen Pro
obzekt
User
Posts: 60
Joined: 29-Apr-2004
# Posted on: 23-Nov-2016 15:01:21   

Thank you Frans. We'll then avoid Linq and focus more on QuerySpec. The migration can be done in stages.

We generated an adapter model, but we don't see the Where() method of the entities supposed to be exposed by QueryFactory. Must be missing sth obvious..

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 23-Nov-2016 15:25:33   

Add to your code file:

using SD.LLBLGen.Pro.QuerySpec; using SD.LLBLGen.Pro.QuerySpec.Adapter;

simple_smile

Frans Bouma | Lead developer LLBLGen Pro
obzekt
User
Posts: 60
Joined: 29-Apr-2004
# Posted on: 23-Nov-2016 17:24:47   

That did it. Thanks! flushed