Этот код пытается присвоить результаты объекту CommodityPrice
.
Для этого ему необходимо вернуть все столбцы, определенные в свойствах столбца сущности CommodityPrice
. Ваш запрос не возвращает НИКАКОГО из них ..
Если вы просто хотите вернуть эти 2 поля, вам потребуется новый объект, содержащий всего 2 поля даты.
TimeFrame
dte_CommodityPriceMinDate datetime Unchecked
dte_CommodityPriceMaxDate datetime Checked
и запрос должен заполнить это вместо:
public IEnumerable<TimeFrame> GetAllTimeFrameDaily()
{
return _dbprice.ExecuteQuery<TimeFrame>("SELECT MIN(CommodityPrice.dtm_Date) AS dte_CommodityPriceMinDate ,MAX(CommodityPrice.dtm_Date) AS dte_CommodityPriceMaxDate FROM CommodityPrice WHERE (CommodityPrice.int_FrequencyId = 1) and int_MarketLocationId in (SELECT [int_LocationId] FROM [Location] where int_LocationTypeId=4 and int_ParentLocationId in (SELECT [int_LocationId] FROM [Location] where int_LocationTypeId=2 and int_ParentLocationId in (SELECT int_LocationId FROM [Location] where int_LocationTypeId = 1 and vcr_LocationEn='Pakistan')))");
}