我正在运行包含child =>的以下查询案例和帐户之间的父关系 - 并包含SELECT:
中的Account.Name string query = "SELECT Case.CaseNumber,Case.Account.Name,Case.Status FROM Case WHERE Status != 'Closed' AND OwnerId IN (SELECT Id FROM User WHERE Email = '" + userEmail + "') ORDER BY Account.Name";
var results = await client.QueryAsync<CaseWorkload>(query);
CaseWorkload类定义为:
public class CaseWorkload
{
public string CaseNumber { get; set; }
public string Status { get; set; }
public string AccountName { get; set; }
}
我无法检索AccountName信息,因为返回的SQL显示&#34; Account.Name&#34;而且我无法在SOQL中找到一种方法来为列添加别名。考虑给定的查询,如何创建类?
答案 0 :(得分:4)
发现它......
您需要执行以下操作才能获取帐户名称 - 当然,如果需要,您可以将帐户名称映射到CaseWorkload中的属性:
public class CaseAccount
{
public string Name { get; set; }
}
public class CaseWorkload
{
public string CaseNumber { get; set; }
public string Status { get; set; }
public CaseAccount Account { get; set; }
}