1. Aaron D'Hooghe
  2. SnapObjects
  3. Wednesday, 6 March 2024 08:43 AM UTC

Hello,

 

I am using the SqlModelMapper to retrieve data. I have noticed that the LoadByPageAsync methode doesn't generate a top x start at x statement in the query.

It retrieves all the records in the database en then creates the page in code. This makes is pretty slow. is there a way to add the top x start at x to the generated qeury?

I saw that there is a Top attribute to add to the models but this is static so you can't really dynamically change this.

 

King regards,

Aaron D'Hooghe

Francisco Martinez @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 6 March 2024 15:10 PM UTC
  2. SnapObjects
  3. # 1

Hi Aaron,

I'm looking at the documentation and I think you can get the QueryBuilder from the SqlModelMapper and then use the Top method (related: page). According to the docs, this adds the TOP keyword to the select statement. 

Not sure if this can work together with LoadByPageAsync, but hopefully gives you an idea of what's possible in case you want to adjust your algorithm.

 EDIT: Mixed up object hierarchies. The proposed workaround is not possible.

Regards,
Francisco

Comment
  1. Aaron D'Hooghe
  2. Wednesday, 6 March 2024 15:29 PM UTC
Hi Francisco,



The methode GetQueryBuilder return an IQueryBuilder not a ISqlQueryBuilder. The IQueryBuilder does not have a Top or Page methode.

Is there a way go from a IQueryBuilder to a ISqlQueryBuilder?



Kind Regards,

Aaron D'Hooghe
  1. Helpful
  1. Francisco Martinez @Appeon
  2. Wednesday, 6 March 2024 16:03 PM UTC
It seems I got deceived by the similar names... Sorry for raising your hopes up in vain. They cannot be converted between each other, they're completely different object hierarchies.



That being the case, I think it would be a nice idea to suggest "I am using the SqlModelMapper to retrieve data. I have noticed that the LoadByPageAsync methode doesn't generate a top x start at x statement in the query. It retrieves all the records in the database en then creates the page in code. This makes is pretty slow. i" as an enhancement request on the Support Portal.



Regards,

Francisco
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.