Problems with IAutoQueryDb is null after update

after i updated to latest version of Servicestack and changed to IAutoQueryDb i get this object as null in my services.
What am i missing?


It shouldn’t be, can you provide the definition for your AutoQuery property? it should be:

public IAutoQueryDb AutoQuery { get; set; }

Hi @mythz,

it is

public class ServiceService : AppServiceBase
    public IAutoQueryDb AutoQuery { get; set; }

And the DTO is

    [Route("/services", Verbs = "GET")]
    public class ServiceQuery : QueryDb<Service, ServiceQueryResponse>

And the AppServiceBase

namespace BokaMera.API.ServiceInterface.Services
    public class AppServiceBase : Service
        public AspnetMembershipAuthSession UserSession
            get { return SessionAs<AspnetMembershipAuthSession>(); }

        public string ApiKey
            get { return Request.Headers["x-api-key"]; }

You have Service here which shouldn’t be referencing the ServiceStack Service class, I would fully qualify the type with the namespace or change the name to avoid ambiguity:

QueryDb<Service, ServiceQueryResponse>

Otherwise everything looks ok so I can’t tell what the issue is from here, if you can put together a small stand-alone example that repro’s the issue I’ll be able to tell what the issue is, the query doesn’t have to work, just an example where the this.AutoQuery dependency is null.

Thx for your reply.
I have now checked and all my services has the same issue with IAutoQueryDb object is null.
So it’s not only the one service that having the problem but all of them.

I can’t really extract the code to create a small project as my project is huge with a lot of dependancys. Is it possible somehow else to find the problem? Teamviewer session? Any other clue?


I solved the problem. The row for adding the AutoQuery feature somehow had dissapeared from the AppHost

//Autoquery feature
Plugins.Add(new AutoQueryFeature { MaxLimit = 100 });

Sorry for my misstake

1 Like