Explicit Autoquery type fields set on server not reflected in NativeTypes output?

Perhaps I am missing/forgetting something as its been a while since I have used AutoQuery. I was trying to add explicit fields on an Autoquery DTO e.g.

public class SearchCustomers
    : QueryDb<vCustomerSearch>
{
    public string NameContains { get; set; }
    public string AddressContains { get; set; }
    public string Address2Contains { get; set; }
    public string CityContains { get; set; }
    public string StateContains { get; set; }
    public string ZipContains { get; set; } 
}

This works fine if done on the client side as a partial and add these, but when defined on the server side and I generate types on the client, I get it back without the explicitly set properties.

public class SearchCustomer : QueryDb<vCustomerSearch>, IReturn<QueryResponse<vCustomerSearch>>
{ }

Are you sure your Server is built correctly and is using your latest class definition? I’ve just tested:

public class SearchCustomers
    : QueryDb<vCustomerSearch>
{
    public string NameContains { get; set; }
    public string AddressContains { get; set; }
    public string Address2Contains { get; set; }
    public string CityContains { get; set; }
    public string StateContains { get; set; }
    public string ZipContains { get; set; }
}

And it’s generating the expected class below using ServiceStack Add Reference:

public partial class SearchCustomers
    : QueryDb<vCustomerSearch>, IReturn<QueryResponse<vCustomerSearch>>
{
    public virtual string NameContains { get; set; }
    public virtual string AddressContains { get; set; }
    public virtual string Address2Contains { get; set; }
    public virtual string CityContains { get; set; }
    public virtual string StateContains { get; set; }
    public virtual string ZipContains { get; set; }
}

Yes I realized in my hasty implementation that I neglected an explicit namespace, once I corrected my bad practices NativeTypes generated the expected output.

1 Like