This question is locked. New answers and comments are not allowed.
Hello,
I'm having problem with following: I have a stored procedure returning data from multiple tables + computed distance:
SELECT TOP(@maxCnt) ctr.[Name] as [LongName], ctr.ISO2Char as ShortName, o.ObjectID as ObjectID, |
p.PropValueID as PropValueID, p.[Value] as [Value], p.UnitValue as UnitValue, o.[Name] as [Name], |
((o.Latitude - @lat) * (o.Latitude - @lat) + (o.Longitude - @lng) * (o.Longitude - @lng)) as Dist |
FROM PropsValues p |
JOIN Object o ON p.OwnerID = o.ObjectID |
JOIN Category c ON o.CategoryID = c.CategoryID |
JOIN geoCountries ctr ON o.Country = ctr.CountryID |
WHERE c.CategoryID = 2 AND p.PropID = 7 |
ORDER BY p.[Value], Dist |
and have defined user-defined persistent class:
public partial class GetChiepestDiesel |
{ |
public GetChiepestDiesel() |
{ |
} |
[Telerik.OpenAccess.FieldAlias("longName")] |
public string LongName |
{ |
get { return longName; } |
set { this.longName = value; } |
} |
[Telerik.OpenAccess.FieldAlias("shortName")] |
public string ShortName |
{ |
get { return shortName; } |
set { this.shortName = value; } |
} |
[Telerik.OpenAccess.FieldAlias("objectID")] |
public int ObjectID |
{ |
get { return objectID; } |
set { this.objectID = value; } |
} |
[Telerik.OpenAccess.FieldAlias("propValueID")] |
public int PropValueID |
{ |
get { return propValueID; } |
set { this.propValueID = value; } |
} |
[Telerik.OpenAccess.FieldAlias("unitValue")] |
public string UnitValue |
{ |
get { return unitValue; } |
set { this.unitValue = value; } |
} |
[Telerik.OpenAccess.FieldAlias("value")] |
public string Value |
{ |
get { return value; } |
set { this.value = value; } |
} |
[Telerik.OpenAccess.FieldAlias("name")] |
public string Name |
{ |
get { return name; } |
set { this.name = value; } |
} |
[Telerik.OpenAccess.FieldAlias("dist")] |
public float? Dist |
{ |
get { return dist; } |
set { this.dist = value; } |
} |
} |
[Telerik.OpenAccess.Persistent(IdentityField = "objectID")] |
public partial class GetChiepestDiesel |
{ |
private string longName; |
private string shortName; |
private int objectID; |
private int propValueID; |
private string unitValue; |
private string value; |
private string name; |
private float? dist; |
} |
which is supposed to be a return type for the stored procedure:
public static class StoredProcedure |
{ |
public static IEnumerable<DataClasses.GetChiepestDiesel> GetCheapestDieselFromLatLng(IObjectScope scope,int? maxCnt,float? lat,float? lng) |
{ |
Query<DataClasses.GetChiepestDiesel> query = scope.GetSqlQuery<DataClasses.GetChiepestDiesel>("GetCheapestDieselFromLatLng ?,?,?","INTEGER maxCnt,FLOAT lat,FLOAT lng"); |
QueryResultEnumerable<DataClasses.GetChiepestDiesel> res = query.ExecuteEnumerable(new object[] {maxCnt,lat,lng}); |
return res; |
} |
} |
Currently I'm getting this error message:
Persistent class 'DataClasses.GetChiepestDiesel' was specified as candidate, but the ResultSet does not contain any/all of the pk columns.
Is there a way how to solve this?
Thanks,
Robert
Robert