早速質問させていただきました。select ステートメント内でこのすべてのロジックを実行できますか?
var entries = atisDAO.GetPME(xl, null);
response.Data.Detectors = new List<DetectorDetails>(entries.Select(pme => new DetectorDetails {ID = pme.PlaceNum.ToString()}));
if(response.Data.Detectors.Any())
{
response.Data.Detectors.ForEach(d =>{
int id;
if(int.TryParse(d.ID, out id))
{
var summaries = atisDAO.GetSummaryEntries(id);
if (summaries.Any())
{
var count = summaries.Sum(summary => summary.TODCount + summary.BFICount + summary.ViolationCount);
var detectionDate = summaries.Max(summary => summary.ReadDate);
d.Count = count.ToString();
d.DetectionTime = new DateTimeZone {
ReadDate = detectionDate.ToString(DATE_FORMAT)
, ReadTime = detectionDate.ToString(TIME_FORMAT)
};
}
}
});
}
選択してからリストをループして、選択した項目を変更するのは間違っていると感じます。selectステートメント内でこれをすべて行うことはできますか?
ヒントをありがとう。
乾杯、
サンディエゴで~ck