Is it a common use of autoquery to use it internally within a service instead of using Ormlite directly?
Or it’s not recommended/a bad idea?
For example:
namespace MYProject.ServiceInterface;
public class MyServices : Service
{
public object Any(Hello request)
{
var res = this.Gateway.Send<QueryCustomers>()
//do logic...
return new HelloResponse { Result = $"Hello, {request.Name}!" };
}
}
It’s just like calling any other service internally, the benefit of using the Service Gateway is that it can continue to work if you decide to later move it to an an external service however in this case it’s just adds a lot of unnecessary overhead vs calling OrmLite directly, e.g. vs Db.Select<Customer>().
Also you can call the AutoQuery API directly, as the done in the Custom AutoQuery Implementations if you need access to some built-in AutoQuery functionality which would also have less overhead than using the Service Gateway:
public class MyServices : Service
{
public IAutoQueryDb AutoQuery { get; set; }
public object Any(Hello request)
{
var query = new QueryCustomers { ... };
var q = AutoQuery.CreateQuery(query, base.Request, Db);
var res = AutoQuery.Execute(query, q, base.Request, Db);
//do logic...
return new HelloResponse { Result = $"Hello, {request.Name}!" };
}
}