我對以下列表中的什麼在linq中返回select中使用什麼感到困惑。返回linq中的select查詢的最佳實踐
1.IEnumerable 2.List 3.ObjectQuery 4. ConvertLinqtoDataTable
你喜歡哪一種?
目前我們在返回記錄時使用了objectquery。
public ObjectQuery StationSelectByStationId(int stationid)
{
var query = from station in _iiqrEntities.Station
where station.StationId == stationid
select station;
return query as ObjectQuery;
}
我會用你的建議,以便我們將規範我們的代碼。 請根據我上面的代碼參考您的答案。
致謝問候
否; 'IQueryable'。這允許SQL鏈接。 – SLaks 2012-03-15 01:44:28
@SLaks:是的,這是正確的。讓我編輯我的答案,以更具體。 – msigman 2012-03-15 01:45:36