I noticed if I use an AutoQuery with a CustomSelect, everything works fine when not used on an IJoin (the custom select value is used).
When I do the same thing using an IJoin TO the class with a CustomSelect, it throws an error:
Invalid column name ‘Latitude’ and Invalid column name ‘Longitude’
Examples
public class Agency {
public int Id { get; set; }
public AgencySettings AgencySettings { get; set; }
}
public class AgencySettings {
[References(typeof(Agency))]
public int Id { get;set; }
// Sql Server location, no native support yet, pulling out lat/lng
[CustomSelect("Location.Lat")]
public string Latitude { get; set; }
[CustomSelect("Location.Long")]
public string Longitude { get; set; }
[Reference]
public Agency Agency { get; get; }
}
public class AgencyResponse {
public int Id { get; set; }
public string Latitude {get;set;}
public string Longitude { get; set; }
}
public class AgencySettingsQuery : QueryDb<AgencySettings> {}
public class AgencyQuery : QueryDb<Agency, AgencyResponse>, IJoin<Agency, AgencySettings> {}
public class AgencyService : Service {
// This works fine, I can see Latitude and Longitude Selected
public object Any(AgencySettingsQuery query) {
/// normal AutoQuery code to build query, get results and return
}
// This throws the error 'Invalid Column 'Latitude'', Invalid column 'Longitude'
public object Any(AgencyQuery query) {
/// normal AutoQuery code to build query, get results and return
}
}
Do Joins not recognize CustomSelect?
EDIT: Additional Testing
This works as expected as well
public object Any(Whatever obj) {
//AgencySettings are populated as expected
var agenciesWithJoin = Db.LoadSelect<Agency>();
return agenciesWithJoin;
}