private static IEnumerable<IFlatMessage> getList(IMapMessages mapper, SqlDataReader reader) { var returnList = new List<IFlatMessage>(); if(reader.HasRows) { while(reader.Read()) { returnList.Add(mapper.Map(reader)); } } return returnList; }
public IEnumerable<IFlatMessage> GetList(IMapMessages mapper) { SqlCommand command; SqlDataReader reader; IEnumerable<IFlatMessage> returnValues = null; using (SqlConnection connection = new SqlConnection(_connectionString)) { connection.Open(); command = new SqlCommand(_queryString, connection); reader = command.ExecuteReader(); returnValues = getList(mapper,reader); reader.Close(); } return returnValues; }
public static IEnumerable<IFlatMessage> GetInsertedRecords(IQueryWrapper query, IMapMessages mapper) { return query.GetList(mapper); }