With the latest 4.5.13 from MyGet, I have found that when a DTO has a byte? property, the C# client will give an ArgumentException “requires 2 values” when using AutoQuery.
For example, Have a SQL table like this:
CREATE Table Customer
(
CustomerID CHAR(20) NOT NULL,
ChargeTo TINYINT NOT NULL
)
OrmLite’s T4 generates a DTO for the table and query like this:
public partial class Customer
{
[Required]
[PrimaryKey]
public string CustomerID { get; set; }
[Required]
public byte ChargeTo { get; set; }
}
public partial class CustomerQuery : QueryDb<Customer>
{
public string CustomerID { get; set; }
public string CustomerIDStartsWith { get; set; }
public string CustomerIDEndsWith { get; set; }
public string CustomerIDContains { get; set; }
public string CustomerIDLike { get; set; }
public string[] CustomerIDBetween { get; set; }
public string[] CustomerIDIn { get; set; }
public byte? ChargeTo { get; set; }
public byte? ChargeToGreaterThanOrEqualTo { get; set; }
public byte? ChargeToGreaterThan { get; set; }
public byte? ChargeToLessThan { get; set; }
public byte? ChargeToLessThanOrEqualTo { get; set; }
public byte? ChargeToNotEqualTo { get; set; }
public byte[] ChargeToBetween { get; set; }
public byte[] ChargeToIn { get; set; }
}
In my Configure, I add the AutoQuery plugin and I choose to wire the route to the request when adding the route:
this.Plugins.Add(new AutoQueryFeature() { EnableAutoQueryViewer = true, MaxLimit = 20 });
this.Routes.Add(typeof(CustomerQuery), "/Queries/Customer", "GET", "Retrieves a list of customers.", "");
This all works, and visiting the /Queries/Customer in a browser correctly retrieves the results as expected.
However, using the ServiceStack client like so:
var client = new ServiceStack.JsonServiceClient("http://127.0.0.1:8088");
var CustomerQueryRequest = new CustomerQuery() { CustomerIDIn = new string[] { "1001", "1002" } };
var CustomerQueryResponse = client.Get(CustomerQueryRequest);
Will throw the exception. If I remove the ChargeTo column from the table or if I change the datatype from TINYINT to INT, regenerate the DTO and QueryDTO and update the ServiceStack reference in the client, then it works.