AutoQuery and NamedConnection

I’m trying to use the NamedConnection attribute with a default autoquery request dto…

Global.asax snippet:

  var dbFactory = new OrmLiteConnectionFactory(sqlConnectionString,SqlServerDialect.Provider);
  container.Register<IDbConnectionFactory>(dbFactory);
  dbFactory.RegisterConnection("pgData", pgConnectionString, PostgreSqlDialect.Provider);

AutoQuery class:

[NamedConnection("pgData")]
[Route("/pgdata/search", "GET")]
public class SearchPgData : QueryDb<PgPoco>
{

}

When I use the AutoQuery Viewer, however, the named connection query requests still seem to be using the default SQL connection, and I get a SQL-specific exception. Am I using the NamedConnection attribute wrong?

Thanks,
Julian

You can use the alternative [ConnectionInfo] Request Filter Attribute for adding it to AutoQuery Services:

[ConnectionInfo(NamedConnection = "pgData")]
[Route("/pgdata/search", "GET")]
public class SearchPgData : QueryDb<PgPoco>
{
}

The [NamedConnection] is for adding on table POCO themselves, e.g:

[NamedConnection("pgData")]
public class PgPoco { ... }

Thanks, you might want to update https://github.com/ServiceStack/ServiceStack/wiki/Multitenancy (AutoQuery Named Connection section) as that’s where I got the example from…

Updated, thx for the pointer!