0
鉴于从ServiceStack端点以下定义执行更复杂的查询:如何使用自动查询
public class LoanQueue
{
public int LoanId { get; set; }
public DateTime Submitted { get; set; }
public DateTime Funded { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public int Fico { get; set; }
public int Fraud { get; set; }
public int CDS { get; set; }
public int IDA { get; set; }
public string Income { get; set; }
public string Liabilities { get; set; }
public string Agent { get; set; }
public string Status { get; set; }
public string State { get; set; }
public string Product { get; set; }
public string Comment { get; set; }
}
public enum DateType
{
None,
Submitted,
Funded
}
[Route("/loan/queue/search", "GET")]
public class LoanQueueQueryGet : QueryBase<LoanQueue>
{
public DateType DateType { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public string AgentUserName { get; set; }
public Languange Languange { get; set; }
public bool WorkingLoan { get; set; }
public bool MicrobusinessLoan { get; set; }
public LoanStatus LoanStatus { get; set; }
}
public object Get(LoanQueueQueryGet request)
{
if (request == null) throw new ArgumentNullException("request");
var profiler = Profiler.Current;
using (profiler.Step("LoanServices.LoanQueue"))
{
SqlExpression<LoanQueue> q = AutoQuery.CreateQuery(request, Request.GetRequestParams());
QueryResponse<LoanQueue> loanQueueResponse = AutoQuery.Execute(request, q);
return loanQueueResponse;
}
}
我的问题是这样的,“它甚至有可能基于在服务请求对象上运行条件逻辑IMPL“?例如
如果DateType == DateType.Submitted
然后查询在LoanQueue的提交属性与BETWEEN子句(起始日期/结束日期)或
如果DateType == DateType.Funded
然后用BETWEEN子句(StartDate/EndDate)在LoanQueue上查询资助的属性。
我的猜测是,我试图弯曲AutoQuery太远,并将更好地服务,只是编码它的旧时尚方式。我非常喜欢AutoQuery插件的烘焙功能,我相信有时候它会适合我的需求。
谢谢 斯蒂芬