public async Task <IEnumerable <Models.Models.Domain.Feedback> > List() { string selectStatement = string.Format("{0}{1}{2}{3}", "SELECT ", string.Join(",", _feedbackConverter.Fields()), " FROM feedback", " ORDER BY feedbackDate DESC"); Task <List <Models.Models.Domain.Feedback> > task = new Task <List <Models.Models.Domain.Feedback> > ( () => { var feedbackList = new List <Models.Models.Domain.Feedback>(); using (IManagedDataReader reader = _sqliteConnectionManager.GetReader(selectStatement, new StatementParameters())) { while (reader.Read()) { feedbackList.Add(_feedbackConverter.Convert(reader)); } } return(feedbackList); }); task.Start(); return(await task); }
private void AddDocument(IndexWriter writer, IManagedDataReader reader) { var houseNumber = reader.DataReader["PAO_START_NUMBER"].ToString(); var suffix = reader.DataReader["PAO_START_SUFFIX"].ToString(); if (!String.IsNullOrWhiteSpace(suffix)) houseNumber += suffix.Trim(); Document doc = new Document(); doc.Add(new Field("id", reader.DataReader["UPRN"].ToString(), Field.Store.YES, Field.Index.NO)); doc.Add(new Field("BuildingName", reader.DataReader["BUILDING_NAME"].ToString(), Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("StartNumber", houseNumber, Field.Store.YES, Field.Index.ANALYZED)); //doc.Add(new Field("StartSuffix", reader.DataReader["PAO_START_SUFFIX"].ToString(), Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("Street", reader.DataReader["STREET_DESCRIPTION"].ToString(), Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("Town", reader.DataReader["TOWN_NAME"].ToString(), Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("AdminArea", reader.DataReader["ADMINISTRATIVE_AREA"].ToString(), Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("PostcodeLocator", reader.DataReader["POSTCODE_LOCATOR"].ToString(), Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("Postcode", reader.DataReader["POSTCODE"].ToString(), Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("PrimaryText", reader.DataReader["PAO_TEXT"].ToString(), Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("SecondaryText", reader.DataReader["SAO_TEXT"].ToString(), Field.Store.YES, Field.Index.ANALYZED)); writer.AddDocument(doc); }