private Address getAddress(SqlDataReader reader, List<string> fields)
{
Address address = new Address();
foreach (string field in fields)
{
try {
address.GetType().GetProperty(field).SetValue(address, reader[field], null);
}
catch(Exception ex)
{
throw new WebFaultException<string>(string.Format("Column <{0}> not found in query results: {1}", field, ex.Message), HttpStatusCode.InternalServerError);
}
}
return address;
}