Trying to use DB_MainQuery  Topic is solved

Discussions relating to the REST API of Jiwa 7.

Trying to use DB_MainQuery

Postby SBarnes » Tue Jul 18, 2017 8:03 pm

Hi Mike,

I am trying to use DB_MainQuery but keep getting back zero results for either of the following two segments of code:

Code: Select all
 DB_MainQuery qry = new DB_MainQuery() { AccountNameStartsWith = "Bits" };
 ServiceStack.QueryResponse<DB_Main> DB_MainQueryResponse;
 DB_MainQueryResponse = client.Get(qry);


or

Code: Select all
 DB_MainQuery qry = new DB_MainQuery();
 ServiceStack.QueryResponse<DB_Main> DB_MainQueryResponse;
 qry.AccountNameStartsWith = "Bits";
 DB_MainQueryResponse = client.Get(qry);


Any ideas as the Swagger Ui does return the expected results the only difference I can see in the request logs to the Swagger UI is that all the properties are in the JSon for the code where as the Swagger UI only has the AccountNameStartsWith?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1620
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Trying to use DB_MainQuery

Postby Mike.Sheen » Wed Jul 19, 2017 10:03 am

Hi Stuart,

I think it is related to this issue.

Try getting the latest ServiceStack client (4.5.13 pre-release) from the SS MyGet - in that you can set a property of a newly introduced ClientConfig static class, i.e.: ServiceStack.ClientConfig.SkipemptyArrays = true;

I think this will fix your issue.
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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Trying to use DB_MainQuery

Postby SBarnes » Tue Jul 25, 2017 9:00 am

Hi Mike,

ServiceStack.ClientConfig.SkipemptyArrays = true;

produced a compile error under 4.5.13, even removing ServiceStack and reinstalling the package completely didn't help.

I have also tried building the necessary components from the latest release on Github and whilst this does then compile it produces errors about null references at run time out of the Json Serialiser.

Unless you have any ideas that I haven't thought of I think we will have to wait for the formal release of 4.5.13 to see if that fixes the issues.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1620
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Trying to use DB_MainQuery  Topic is solved

Postby Mike.Sheen » Thu Jul 27, 2017 7:17 pm

Hi Stuart,

This tripped me up also - this is what I did to get the Latest SS 4.5.13, when I already had a previous SS 4.5.13 installed:

1. Delete the packages folder under your solution
2. Download the nuget.exe command line tool from here.
3. open a command prompt and navigate to where the nuget.exe downloaded in step 2 is location
4. run the command: nuget locals all -clear
5. run the command: del %LOCALAPPDATA%\NuGet\Cache\*.nupkg /q
6. now load your solution, and build

The above assumes you've already added https://www.myget.org/F/servicestack as a package source by visiting Tools -> Options -> Package Manager -> Package Sources in Visual Studio, and made this source the first in the list of package sources.

Note that the odd numbered versions of SS are their MyGet pre-releases - when finalised they change to the next even number and publish under nuget - so 4.5.14 will be the "official" next version of ServiceStack libraries - unless they jump to 4.6.0 or 5.0.0 first.
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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Trying to use DB_MainQuery

Postby SBarnes » Thu Jul 27, 2017 7:31 pm

Hi Mike,

Thanks for the idea, I'll give it a go and let you know if I am reading you correctly you think I am getting the same problem that ServiceStack advised you on regarding the cache?

By the way in terms of Jiwa have you ever considered integrating nuget?

See this link http://blog.nuget.org/20130520/Play-with-packages.html , just thought it may not be such a great leap from your embedded references, although I realise with visual studio you can get the package and add it in manually just as in most case you can grab stuff from GitHub, it would certainly make development of plugins easier.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1620
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Trying to use DB_MainQuery

Postby SBarnes » Sat Jul 29, 2017 12:00 pm

Hi Mike,

Great news its working perfectly now, as the DTO only contains the filled in properties, although I did discover one issue I was having , you have query the right property, Name and not Account Name. :roll:

The is also the property JsConfig.IncludeNullValues that can be set as well.

As always thanks for the help.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1620
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Trying to use DB_MainQuery

Postby Mike.Sheen » Sat Jul 29, 2017 2:36 pm

SBarnes wrote:Great news its working perfectly now, as the DTO only contains the filled in properties, although I did discover one issue I was having , you have query the right property, Name and not Account Name. :roll:


Glad to hear it's sorted for you!

RE: AccountName vs Name - yeah... AccountName is the bank account name, which really should be moved out of DB_Main and into a relational table so debtors can have multiple bank accounts - We'll get to that "one day"(TM).

SBarnes wrote:I am reading you correctly you think I am getting the same problem that ServiceStack advised you on regarding the cache?


Yes, except the additional step I had to do was delete the packages folder. Note in VS 2017 this is much simpler - they have a "clear package cache" button (or similar - the exact name escapes me right now) in the VS options which "just works".

SBarnes wrote:See this link http://blog.nuget.org/20130520/Play-with-packages.html , just thought it may not be such a great leap from your embedded references


I've had a look, and it's a neat idea to have the plugin have nuget package references. I'll put a pin in that and explore what we can do there at a later time.

EDIT: Oh, BTW one breaking change in 7.00.185.00 is the IJiwaRESTAPIPlugin interface no longer has two Configure methods - we had two (one for self-hosted and one for IIS) - which duplicated a lot of code in the standard REST API plugin and any custom API plugins you might have - now there is just one Configure method, when works with both self hosted and IIS. Our docs article has been modified to reflect this.

We're just adding Sales Quote functionality to the API and then we'll release 7.00.185.00 with those changes in it - with luck that'll be next week.
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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757


Return to REST API

Who is online

Users browsing this forum: No registered users and 2 guests