Hi
Thanks for you help, i have test my api with AutoQuery and it’s work very well.
But i find if i use AutoQuery, the swagger feature will be break. For example, i create my DTO like this
[Route("/notices","Get")]
public class FindNotices : QueryBase<Notice>
{
public long Id { get; set; }
public int? NoticeType { get; set; }
}
I can see the “Notice” entry in the swagger-ui, but when i click it, it’s not giving any response.
mythz
July 20, 2015, 12:15am
2
I’ve added a few fixes to Swagger support where this should be fixed now in v4.0.43+ that’s now on MyGet .
If you’ve already got MyGet installed see instructions for redownloading from MyGet .
I find auto query has a lot of good feature, i am not sure if i need these feature, for example, <age,age<.
could you tell me which scenario is suitable to use auto query?
Does SS suggest AutoQuery to expose wab api?
mythz
July 20, 2015, 2:46pm
4
It just provides Automatic Querying for your Database Table without having to manually implement the service to do it yourself.
So with just this AutoQuery Request DTO:
[Route("/notices","GET")]
public class FindNotices : QueryBase<Notice> {}
You can query any of the fields on the Notice
table, e.g: you can query all Notices with Id’s greater than 100 with:
/notices?Id>=100
Read the AutoQuery Documentation for other examples.
Hi
I has read document,I just want to know which style is suggested by you, i find the example below is different from AutoQuery. I think AutoQuery can do everything instead of my DIY service, but i really don’t like study the syntax of it.
c#, rest, servicestack
mythz
July 21, 2015, 5:28pm
6
AutoQuery doesn’t replace all Services, from the Basic Customers REST example the only Service that you could use AutoQuery for is:
[Route("/customers", "GET")]
public class GetCustomers : IReturn<List<Customer>> { }
Which if I needed to Query Customers (i.e. instead of returning all Customers) I would replace with:
[Route("/customers", "GET")]
public class QueryCustomers : QueryBase<Customer> { }
Which will now let you query Customers, e.g:
/customers?Name=John+Doe
/customers?NameContains=John
/customers?Id=1
/customers?Id<=10
Refer to AutoQuery docs for other examples.