Auto Query Max Limit  Topic is solved

Discussions relating to the REST API of Jiwa 7.

Auto Query Max Limit

Postby SBarnes » Mon Sep 17, 2018 3:37 pm

Hi Mike

Is there a value that the api's max limit can be set to that makes it infinite?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Auto Query Max Limit

Postby SBarnes » Wed Sep 26, 2018 7:22 pm

Bump
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Auto Query Max Limit  Topic is solved

Postby Mike.Sheen » Tue Mar 26, 2019 3:41 pm

Just not setting it to any value is the equivalent of infinite.

We, however, set the value in our standard REST API plugin to be the value of a System Setting - "AutoQueryMaxLimit" - and if that's invalid or not present we default to 100.

You could modify our standard plugin from this:
Code: Select all
// Add AutoQuery plugin
AppHost.Plugins.Add(new AutoQueryFeature() { EnableAutoQueryViewer = true, MaxLimit = autoQueryMaxLimit });

 AppHost.Plugins.Add(new AutoQueryDataFeature { MaxLimit = autoQueryMaxLimit });

To this:
Code: Select all
// Add AutoQuery plugin
AppHost.Plugins.Add(new AutoQueryFeature() { EnableAutoQueryViewer = true});

 AppHost.Plugins.Add(new AutoQueryDataFeature);


Which would do it - but that's not ideal as modifying our standard plugin isn't recommended and operating on a copy whilst is recommended over editing our standard plugin, you have a whole new set of problems when upgrading in the future and trying to merge in any new changes to the standard plugin to your copied one.

So the ideal solution is to create a new plugin to override the MaxLimit of the AutoQuery plugins to be null, effectively removing any limits:

Code: Select all
public void Configure(JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin, ServiceStack.ServiceStackHost  AppHost, Funq.Container Container, JiwaApplication.Manager JiwaApplicationManager)
{
   foreach(IPlugin plugin in AppHost.Plugins)
   {
      if (plugin is AutoQueryDataFeature)
      {
         AutoQueryDataFeature autoQueryDataFeaturePlugin = (AutoQueryDataFeature)plugin;
         autoQueryDataFeaturePlugin.MaxLimit = null;               
      }
      else if (plugin is AutoQueryFeature)
      {
         AutoQueryFeature autoQueryFeaturePlugin = (AutoQueryFeature)plugin;
         autoQueryFeaturePlugin.MaxLimit = null;               
      }
   }         
}


Sample plugin with the above is attached.
Attachments
Plugin Remove MaxLimit REST API.xml
(23.86 KiB) Downloaded 87 times
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755


Return to REST API

Who is online

Users browsing this forum: No registered users and 1 guest