public LineEntity this[int lineId] { get { if (lineList == null) { lineList = new List <LineEntity>(); } LineEntity matchedLine = SearchLineFromLineList(lineId); if (needCheckQuery) { if (matchedLine == null) { try { matchedLine = SeachLineByQuery(lineId); lineList.Add(matchedLine); } catch (Exception exception) { throw exception; } } } return(matchedLine); } }
private LineEntity SeachLineByQuery(int lineId) { List <Line> matchedLineList = metroWeb.MetroWebDatabase.Table <Line>().Select(new Line { LineId = lineId }); if (matchedLineList.Count == 0) { throw new Exception(string.Format("line id {0} is not found", lineId)); } LineEntity matchedLineEntity = new LineEntity(metroWeb, matchedLineList[0]); return(matchedLineEntity); }
private List <LineEntity> SeachLineByQuery() { List <Line> matchedLineList = metroWeb.MetroWebDatabase.Table <Line>().Select(); List <LineEntity> matchedLineEntityList = new List <LineEntity>(); foreach (Line matchedLine in matchedLineList) { if (!lineList.Exists(line => line.LineId == matchedLine.LineId)) { LineEntity lineEntity = new LineEntity(metroWeb, matchedLine); matchedLineEntityList.Add(lineEntity); } } return(matchedLineEntityList); }
private List <LineEntity> SeachLineByQuery(string lineName) { List <Line> matchedLineList = metroWeb.MetroWebDatabase.Table <Line>().Select(new Line { LineName = lineName }); if (matchedLineList.Count == 0) { throw new Exception(string.Format("line name {0} is not found", lineName)); } List <LineEntity> matchedLineEntityList = new List <LineEntity>(); foreach (Line matchedLine in matchedLineList) { if (!lineList.Exists(line => line.LineId == matchedLine.LineId)) { LineEntity lineEntity = new LineEntity(metroWeb, matchedLine); matchedLineEntityList.Add(lineEntity); } } return(matchedLineEntityList); }